What is this error?
I face this error when user authenticate and redirect to admin route.
and gave this error. even if role exist.
Here is my route
Route::group(['domain' => '{subdomain}.localhost', 'middleware' => 'checkdomainanddatabase'], function () {
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::group(['prefix'=> 'admin', 'middleware' => ['role:admin']], function ($subdomain) {
Route::get('/dashboard', function ($subdomain) {
return "writer idr agya hai";
})->name('admin.dashboard');
});
});
Here is my login controller
$role = Auth::user()->getRoleNames();
// Check user role
switch ($role[0]) {
case 'writer':
return route('admin.dashboard');
break;
default:
return '/home';
break;
}
Without seeing more code, I'm guessing maybe it's referring to the role:admin middleware not being defined in your app.
Most helpful comment
Without seeing more code, I'm guessing maybe it's referring to the
role:adminmiddleware not being defined in your app.