i am using laravel 5.1.8. i am making a login/registration system. i made a controller named AdminController and protect it with middleware.
but i am using laravel\'
Include \App\Http\Middleware\RedirectIfAuthenticated::class
middleware in $middlewareGroups "web" array after \Illuminate\Session\Middleware\StartSession::class
middleware
then modify your redirect path in handle()
method of RedirectIfAuthenticated
public function handle($request, Closure $next, $guard = null)
{
//check if authenticate && second is condition when we need to redirect i.e,
if(Auth::guard($guard)->check() && $request->route()->named('login') ) {
return redirect()->route('dashboard');
}
return $next($request);
}