protected function authenticated(Request $request, User $user)
{
// redirect to the regular 'after login' route
//check user role
if( $user->hasRole('Admin') || $user->hasRole('Master') ) {
return redirect()->intended('/masterhome');
}
else {
return redirect()->intended('/home');
}
}
The main block of code we should concentrate on is the first if statement. In this block we grab the user data that is attempting to sign in and check the role of the account. Then we proceed to redirect the user to their destination URL.
Note: This is for Laravel 5.3