Hello work on laravel 5.7 but i have a bug with the authentification, i have a admin middleware and a roles table, i add a role_id on my users table and add the logic for checkh the role and redirect the authenticated user but always be redirect to the homepage, here is my route file
Route::get('/', 'HomeController@index')->name('home');
Auth::routes();
Route::get('/confirm/{id}/{token}','Auth\RegisterController@confirm');
Route::group(['as'=>'admin.','prefix'=>'admin','namespace'=>'Admin','middleware'=>['auth','admin']], function (){
Route::get('dashboard','DashboardController@index')->name('dashboard');
});
Login controller
public function __construct()
{
if (Auth::check() && Auth::user()->role_id == 1) {
$this->redirectTo = route('admin.dashboard');
} else {
$this->redirectTo = route('agent.dashboard');
}
$this->middleware('guest')->except('logout');
}
I modified the file ifredirectAuthenticated but nothing work get redirect to homepage
In LoginController:
public function redirectPath()
{
return route('dashboard');
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community