chilly2go / nova-permissions
Nova Permissions tool based on spatie permissions
Package info
github.com/chilly2go/nova-permissions
Language:Vue
pkg:composer/chilly2go/nova-permissions
Fund package maintenance!
Requires
- php: >=8.0
- ext-readline: *
- laravel/nova: ^4.0
- spatie/laravel-permission: ^6.1.0
Requires (Dev)
- orchestra/testbench: ^v10.8.0
- phpunit/phpunit: ^12.5.4
README
Nova Permissions tool based on spatie permissions
I liked how GrapheneICT/nova-permissions looked. But it lacked nova 4 support. So here is what I think might be an "ok" take on working with Nova 4 and Spatie/Permissions v6.
Installation
You can install the package in to a Laravel app that uses Nova via composer:
composer require chilly2go/nova-permissions
Next up, you must register the tool with Nova. This is typically done in the tools method of the NovaServiceProvider.
By adding the tool the included Field and Resources are being registered.
// in app/Providers/NovaServiceProvider.php // ... public function tools() { return [ // ... new \chilly2go\NovaPermissions\Tool, ]; }
Publishing assets
Database migrations
This migration adds a new column to the permissions table for grouping permissions. This is required for this package to work. It will initially iterate all permissions and try to set a reasonable default group based on the permission name.
php artisan vendor:publish --provider="chilly2go\NovaPermissions\ToolServiceProvider" --tag="migrations"
Config Files
This is optional and allows adjustments for Nova resource groups and translation prefix
php artisan vendor:publish --provider="chilly2go\NovaPermissions\ToolServiceProvider" --tag="config"
Translation
There is a translation file included that (by running the command below) will publish the translations to your projects lang folder. This is setup this way to allow easy enhancement for group name translations.
php artisan vendor:publish --provider="chilly2go\NovaPermissions\ToolServiceProvider" --tag="lang"
Usage
By adding the tool in your ServiceProvider the Field and Resources are being registered. Resources will be shown in the Nova sidebar based on the configuration in the config file.
I have not yet found a way to set displayInNavigation from a function call (config('...')) so those two settings are without a function.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email code@chilly2go.de instead of using the issue tracker.
Credits
- This Package is inspired by GrapheneICT/nova-permissions
- Which is inspired by eminiarts/nova-permission
- chilly2go
License
The MIT License (MIT). Please see License File for more information.