Request for assistance with Spatie on Laravel 11 #2665
-
Hello Spatie Team, I hope this email finds you well. I am currently working on a Laravel 11 application and using your Spatie package for role and permission management. In the previous version of Laravel, we used to register Spatie middlewares in the kernel.php file as follows: use Spatie\Permission\Middlewares\RoleMiddleware;
protected $middlewareAliases = [
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
]; However, in Laravel 11, the kernel.php file no longer exists and I cannot find how to register Spatie middlewares. Without this configuration, I am getting the following error: "Target class [role] does not exist." Could you please guide me on how to configure Spatie middlewares in Laravel 11? Thank you in advance for your valuable assistance. Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
https://laravel.com/docs/11.x/middleware#registering-middleware |
Beta Was this translation helpful? Give feedback.
-
Is this correct? vscode tells me something is missing |
Beta Was this translation helpful? Give feedback.
-
Yes I test thank you |
Beta Was this translation helpful? Give feedback.
https://laravel.com/docs/11.x/middleware#registering-middleware
https://spatie.be/docs/laravel-permission/v6/basic-usage/middleware#content-package-middleware