Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- You can do this handle the request in the Middleware RedirectIfAuthenticated.php inside the handle function like this:
- /**
- * Handle an incoming request.
- *
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
- * @param string|null $guard
- * @return mixed
- */
- public function handle($request, Closure $next, $guard = null)
- {
- if (Auth::guard($guard)->check()) {
- if (Auth::user()->role == 'admin') {
- return redirect('/admin');
- }else{
- return redirect('/');
- }
- }
- return $next($request);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement