rickselby / laravel-permission-setup
Setting up permissions
Installs: 8 368
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
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