I have done laravel auth with is_admin field like:
if(auth()->user()->is_admin == 1){
return $next($request);
}
and defined it in route so if the user is admin, can be redirected to voyager dashboard page.
Route::group(['prefix' => 'admin'], function()
{
Voyager::routes();
Route::get('admin', 'HomeController@admin')->middleware('admin');
});
When I login, it's redirected to specific page but with error message:
Target class [VoyagerController] does not exist.
What should I do to return voyager admin page?
You can use middleware admin.user .
Route::group(['prefix' => 'admin'], function()
{
Voyager::routes();
Route::get('admin', 'HomeController@admin')->middleware('admin.user');
});
Hope this will work. This will:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.