rickselby / laravel-permissions-setup
This package is abandoned and no longer maintained.
The author suggests using the rickselby/laravel-permission-setup package instead.
Setting up permissions
v4.6.0
2024-03-12 21:03 UTC
Requires
- illuminate/config: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- spatie/laravel-permission: ^3.0|^4.0|^5.0
README
When using spatie/laravel-permission I have a pattern I always follow; I only use permissions in the code, not roles. Since the permissions will be hard-coded, I want a way of creating the permissions in the database from a list.
This really, really simple class loads a list of permissions from config/permissions.php
and creates them (if they
don't already exist).
Install the package using composer:
$ composer require rickselby/laravel-permission-setup
Then, if using Laravel 5.4, add the service provider to the providers array:
// config/app.php 'providers' => [ ... RickSelby\Permission\PermissionServiceProvider::class, ];
You can publish the default permissions config file with
php artisan vendor:publish --provider="RickSelby\Permission\PermissionServiceProvider" --tag="config"
Now, you can load and reload the list of permissions with the artisan command:
php artisan permission:update