Permissions Generator
This package add some artisan command to help generating permissions for your declared routes.
Each route should have an alias (name) seperated by dot(.) for exemple:
Route::get('/posts/special_action',[App\Http\Controllers\PostController::class, 'specialaction'])->name('posts.specialaction');
Route::get('/posts/another_action',[App\Http\Controllers\PostController::class, 'anotheraction'])->name('posts.anotheraction');
In this example permissions will be generated for the PostController linked to the specialaction and anotheraction
public function __construct()//#
{
$this->middleware('auth');
$this->middleware(['permission:posts.specialaction'])->only(['specialaction']);
$this->middleware(['permission:posts.anotheraction'])->only(['anotheraction']);
}//#
Take a look at contributing.md to see a to do list.
Installation
Via Composer
$ composer require mouhamedfd/permissions-generator
Publish configuration
php artisan vendor:publish --tag=permissions-generator.config
The default configuration exclude some keywords and some columns, it's also possible to add some middlewares
return [
'excluded_keywords'=>[
'Auth',
'Translation',
],
'have_resource_column'=>false,
'have_description_column'=>false,
'middlewares'=>[
'auth',
],
];
Usage
Simulation mode
php artisan permission:generate
Database mode
php artisan permission:generate --action=database
Insertion to controllers
php artisan permission:generate --action=controllers
Change log
Please see the changelog for more information on what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Credits
License
MIT. Please see the license file for more information.