Download the PHP package zakariajawas/permissions-generator without Composer
On this page you can find all versions of the php package zakariajawas/permissions-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zakariajawas/permissions-generator
More information about zakariajawas/permissions-generator
Files in zakariajawas/permissions-generator
Package permissions-generator
Short Description Generate default permissions for spatie permissions package according to your models
License MIT
Informations about the package permissions-generator
Permissions Generator
Generate basic permissions for spatie permissions package for all your models at once using one artisan command.
This package contains a GeneratePermissionsProvider
that you can use in your packages to easily register the config file and the artisan command.
What It Does
If you are using spatie permissions package, you need to create permissions for roles manually, common permissions for all models are access (list), create, edit and delete
This package will create all the basic permissions for all models using only one artisan command.
If you have the following models [Category, Product] as example, after running the generate command, the following rows will be inserted in your permissions table
Note: You can modify some values inside the config file, check Working with config file section below.
Getting started
Installation
You should publish the config/permissionsgenerator.php config file with:
Working with config file
In config/permissionsgenerator.php file you can modify the following values.
-
Modify this value to add, update or delete a permission.
These are the basic permissions.
For example to add access permission and change edit to update you can do this.
-
By default the package will generate the permissions for all project models, you might want to exclude specific one or more models so you can do this.
- If you have static permissions which are not related to models for example export to pdf or access all data or maybe a page which doesn't have a model you can add these permisisons in $staticPermissions array
Note:-
1) You have to add the full model class path. 2) You don't have to exclude other packages models, this package won't create permissions for them.
- Default permissions name is
permission + model name
, if you want to add a prefix you can specify it here.
Result will be can create product
instead of create product
License
The MIT License (MIT). Please see License File for more information.
Author
Zakaria Jawas @zakariajawas
Getting help
If you spot a problem you can open an issue on the Github page, or alternatively, you can contact me via [email protected]
Support the library by twitting in
If you enjoy it, please make this library better :+1: