I have this admin middleware:
public function handle($request, Closure $next, $guard = null)
{
if (Auth::check()) {
if ($request->user()->is_admin == 1) {
return $next($request);
}
return redirect('/login');
} else {
return redirect('/login');
}
}
And in the logincontroller, if the user is admin, they are redirected to /admin.
and if not redirected to /home.
protected function authenticated()
{
if (auth()->user()->is_admin == 1) {
return redirect('/admin');
} else {
return redirect('/home');
}
}
Now, when admin logs in, they are redirected to /admin
but, on clicking back button of browser they are in /home
. How could i not redirect the admins to /home
. /home
is under auth middleware group.