This is the documentation for
v2 but the latest version is
v5
.
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show spatie/laravel-permission
You can create a role or permission from a console with artisan commands.
php artisan permission:create-role writer
php artisan permission:create-permission "edit articles"
When creating permissions/roles for specific guards you can specify the guard names as a second argument:
php artisan permission:create-role writer web
php artisan permission:create-permission "edit articles" web
When creating roles you can also create and link permissions at the same time:
php artisan permission:create-role writer web "create articles|edit articles"