laravel-8laravel-permission

Laravel-permission Undefined type PermissionRegistrar


I'm trying to install the package Laravel-permission v5 for a project in Laravel 8.

Following the instructions at the documentation, I runned

composer require spatie/laravel-permission

and to be able to migrate the permission tables I executed:

php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"

Instantly, in the file database/migrations/create_permission_tables.php it gives me the error

Undefined type 'Spatie\Permission\PermissionRegistrar

What can I do? I'm new in Laravel


Solution

  • Did you import it in config/app.php ??

    Try this:

     php artisan optimize:clear
     # or
     php artisan config:clear
    
     php artisan migrate