DEV Community

Chidiebere Chukwudi
Chidiebere Chukwudi

Posted on

Target class [role] does not exist: Laravel

Hi, quickly: if this is as a result of using the spatie laravel role package, use this approach to solve the problem

Add the following to $routeMiddleware array located in app/Http/Kernel.php:

'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,

'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,

'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
Enter fullscreen mode Exit fullscreen mode

Reference

Top comments (0)