-
I've upgraded to Laravel 11 and permissions seem to have broken - at least the middleware part of it has. In composer: {
"require": {
"spatie/laravel-permission": "^6",
}
} In middleware classes I've used: protected $middlewareAliases = [
// ...
'role' => RoleMiddleware::class,
'permission' => PermissionMiddleware::class,
'role_or_permission' => RoleOrPermissionMiddleware::class,
]; And finally, my web routing is as follows: Route::prefix('dashboard')
->middleware(
[
'web',
'auth',
'verified',
'can:read_dashboard' // a valid permission the user has
]
)->group(function () {
// ...
}); This fails with There were a few other classes changed but they should be unrelated (for example, I've removed Sanctum). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I've found the answer: as this is an upgrade, some parts of the cache were "old" - I assume config etc. Running the following will resolve this:
|
Beta Was this translation helpful? Give feedback.
I've found the answer: as this is an upgrade, some parts of the cache were "old" - I assume config etc. Running the following will resolve this:
php artisan optimize:clear