Reference: https://stackoverflow.com/questions/42177044/laravel-5-4-redirection-to-custom-url-after-login
web.php
in registrationcontroller
in logincontroller
in middleware/redirectifauthenticated
web.php
// Route::get('/home', 'HomeController@index')->name('home');
Route::get('/adminpannel/hmc', 'HomeController@index')->name('home');
in registrationcontroller
// protected $redirectTo = '/home';
protected $redirectTo = '/adminpannel/hmc';
in logincontroller
// protected $redirectTo = '/home';
protected $redirectTo = '/adminpannel/hmc';
in middleware/redirectifauthenticated
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/adminpannel/hmc');
}
return $next($request);
}
Comments
Post a Comment