reksmey / filament-spatie-roles-permissions
filament-spatie-roles-permissions
Installs: 171
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 1
Forks: 7
Open Issues: 0
Type:library-filament-plugin
Requires
- php: ^8.0
- filament/filament: ^2.0
- illuminate/support: ^8.0
- spatie/laravel-permission: ^5.4
Requires (Dev)
- nunomaduro/collision: ^5.10
- nunomaduro/larastan: ^1.0
- orchestra/testbench: ^6.22
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2022-03-18 01:39:40 UTC
README
Description
This plugin is built on top of Spatie's Permission package.
Installation
You can install the package via composer:
composer require reksmey/filament-spatie-roles-permissions
Since the package depends on Spatie's Permission package. You have to publish the migrations by running:
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
Now you should add any other configurations needed for the Spatie-Permission package.
Usage
You can add this to your form method in your UserResource
return $form->schema([ ... BelongsToManyMultiSelect::make('roles')->relationship('roles', 'name') ... ... ])
Advance Usage
You can publish permissions seeders in additional permissions. Sometimes you may add more action such as download-pdf, export, etc.
php artisan vendor:publish --tag=filament-spatie-roles-and-permissions-seeders Then php artisan db:seed --class=RolesAndPermissionsSeeder
Customize RoleResource
- publish service provider
php artisan vendor:publish --tag=filament-spatie-roles-and-permissions-provider
- add the package to the
extra.laravel.dont-discover
key incomposer.json
, e.g."extra": { "laravel": { "dont-discover": [ "reksmey/filament-spatie-roles-permissions" ] } }
- publish RoleResource
php artisan filament-spatie-roles-permissions:publish-role-resource
- you can customize RoleResource in App\Filament
For authorization, Filament will observe any model policies that are registered in your app
Hope you enjoy it ❤️
Security
If you discover any security related issues, please create an issue.
Credits
License
The MIT License (MIT). Please see License File for more information.