Created
October 21, 2018 11:06
-
-
Save jvadillo/df60e945d19c62d2cd887c839cc06dfc to your computer and use it in GitHub Desktop.
Redirect after login depending on user role
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Edit the following function (RedirectIfAuthenticated.php): | |
public function handle($request, Closure $next, $guard = null) | |
{ | |
if (Auth::guard($guard)->check()) { | |
//return redirect('/inicio'); | |
if(Auth::user()->hasAnyRole('admin')){ | |
return redirect()->route('datos'); | |
} | |
else if (Auth::user()->hasAnyRole('club','equipo')){ | |
return redirect()->route('inicio'); | |
} | |
} | |
return $next($request); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment