I'm using Laravel-Permissions and wrote in rotes\web.php:
Route::group(['middleware' => ['role:admin']], function () {
Route::get('/admin', function () {
return "Test";
});
});
I added in app\Http\Kernel.php :
protected $routeMiddleware = [
// ...
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
];
Error: