Skip to content

jvkassi/filament-shield

 
 

Repository files navigation

filament-shield-art

Filament Shield

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

One Plugin to rule them all, One Plugin to find them, One Plugin to bring them all, and in the light bind them, In the Land of Filament where building them is really fun!

Support Filament

filament-logo

Installation (New Apps)

  1. Install the package via composer:
composer require bezhansalleh/filament-shield
  1. Publish the config file with:
php artisan vendor:publish --tag="filament-shield-config"
  1. Configure super_admin role and change the role_name to something of your choosing. It is recommend to leave it enable this way every permission generated will be automatically assigned to this role. then you would only need to assign this role to your super admin user.
'super_admin' => [
    'enabled' => true,
    'role_name' => 'super_admin',
],
  1. Now run the following command to setup everything:
php artisan shield:install

Follow the prompts and enjoy!

Installation (Existing Apps)

  1. For existing apps run the following command to setup everything:
php artisan shield:install --fresh

Beaware, that even though there are checks in place but if confirmed; existing policies might get overwritten.

RolePolicy

To ensure RoleResource access via RolePolicy you would need to add the following to your AuthServiceProvider:

//AuthServiceProvider.php
...
protected $policies = [
    'Spatie\Permission\Models\Role' => 'App\Policies\RolePolicy',
];
...

Optionally, you can publish the translations using

php artisan vendor:publish --tag="filament-shield-translations"

Available Filament Shield Commands

  shield:create    # Create Permissions and/or Policy for the given Filament Resource Model
  shield:generate  # (Re)Discovers Filament resources and (re)generates Permissions and Policies.
  shield:install   # One Command to Rule them All 🔥
  shield:publish   # Publish filament shield's Resource.

Chores

  • Imporve documentation 📝
  • A command to reverse everything 🤯
  • handle except or only options for Permission and Policy generation 👀
  • improve automation or add new features... ⏭

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Filament support for `spatie/laravel-permission`

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%