I am using Laravel Framework 5.4.10, and I am using the regular authentication that
php artisan make:auth
provides. I want to protect the
The way I've done it by using AuthenticatesUsers trait.
\App\Http\Controllers\Auth\LoginController.php
Add this method to that controller:
/**
* Check user's role and redirect user based on their role
* @return
*/
public function authenticated()
{
if(auth()->user()->hasRole('admin'))
{
return redirect('/admin/dashboard');
}
return redirect('/user/dashboard');
}