When a user logs in, this is done through your LoginController.php
which is located at app\Http\Controllers\Auth
This controller uses a trait called AuthenticatesUsers
.
This trait has a method called authenticated()
which by default is empty. This method is called if it's not empty by the trait - after all the necessary loggin in stuff has been done.
You could override this method in your AuthenticationController.php
and add the functionality you are asking for. An example would be:
// You actually get an Auth\User object passed to you by the trait!
public function authenticated(Request $request, $user)
{
if($user->role == 'admin') {
// You could do anything here
return redirect()->route('admin-dashboard');
} else {
return redirect()->route('home');
}
}