Acl
Laravel Route based ACL., (*1)
Requirements
- Laravel 5.4 with Passport
Getting Started
1.Install via
composer require ashamnx/acl
, (*2)
2.Add the package to your application service providers in config/app.php
., (*3)
'providers' => [
...
Ashamnx\Acl\AclServiceProvider::class,
],
3.Migrate using php artisan migrate
, (*4)
4.Add the middleware to your app/Http/Kernel.php
., (*5)
protected $routeMiddleware = [
....
'acl' => \Ashamnx\Acl\Middleware\AclMiddleware::class,
];
5.Make sure all routes that use the middleware are named and the name has the format [prefix].[resource].[action], (*6)
Route::middleware(['acl'])->get('test/win', function() {
return 'Testing win';
})->name('testing.win');
6.Run php artisan acl:init
to create an Administrator
group and give all access., (*7)