Below code explains the laravel redirection afterlogout.
After logout if you try to access home/dashboard, it will redirect to following url
http://localhost/schoolidcard/public/index
if we try to access the below url
http://localhost/schoolidcard/public/superadmin/dashboard
it should redirect to http://localhost/schoolidcard/public/superadmin/
instead of this it is redirecting to below path
http://localhost/schoolidcard/public/index
Solution:for redirecting to superadmin/login .Add the below lines of code in the Redirectifauthenticated.php
1 2 3 4 5 6 7 8 |
public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { return redirect('/'); } return $next($request); } |
Changes to…
1 2 3 4 5 6 7 8 |
public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { return redirect('/'); } else return redirect('superadmin/login'); return $next($request); } |