spatie/laravel-permission

Target class [Spatie\Permission\Middlewares\PermissionMiddleware] does not exist.

Az-Renaud-HOUENOU opened this issue · 2 comments

I'm working on a laravel project. For roles and permissions I use laravel-permission, so I installed spatie permission. I made all the necessary configurations: added Spatie\Permission\PermissionServiceProvider::class, in config/app.php, I executed the php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider ", php artisan migrate. I added 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class, in app/Http/kernel. When running my project I encounter this error: Target class [Spatie\Permission\Middlewares\PermissionMiddleware] does not exist. which completely prevents me from moving forward. It indexes the portion for me: $response = $kernel->handle(

 $request = Request::capture()

)->send(); from my public/index.php file. I can't solve it.

Looks like you're following outdated documentation.

The latest package version today is v6, in which the namespace is Middleware.
Versions v5 and older used Middlewares.

Looks like you're following outdated documentation.

The latest package version today is v6, in which the namespace is Middleware. Versions v5 and older used Middlewares.

I see! That's actually the reason. It's already settled. Thank you so much!