I am using Laravel 5 on a Windows dev machine. I want to configure and use Auth middleware throughout my application to support authentication. My use case is standard. There are two (or three) user classes - Administrator and Normal (all users who are not administrators will be regular).
The administrator has the obvious role of backend management and, therefore, has a separate routing group / admin / , which should redirect the illegal user to / admin / login . I set it up like this.
Route::group(['middleware'=>'auth', 'prefix' => 'admin'], function() { Route::get('login','App\ AuthController@getLogin '); Route::post('login','App\ AuthController@postLogin '); });
When the login form is issued , how can I ask Auth to add a filter
- or just check among those users where "is_admin" is true ?
- or ask him to join the User and UserRoles table first to identify only users with the administrator role?
source share