zezont4 / laravel-acl
Add ACL layer to your app and provide an interface to manage users,rules and permissions
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- php: ~5.5|~7.0
- laravelcollective/html: 5.2.*
This package is auto-updated.
Last update: 2024-10-28 05:41:56 UTC
README
Requirements
PHP >= 5.5.9
Laravel >=5.2
Auto Loaded : [laravelcollective/html package for form & html](https://laravelcollective.com/docs/5.2/html)
Thanks
This package is based on @heerasheikh post :
http://heera.it/laravel-5-1-x-acl-middleware#.Vwxunpl95TH
with some fixes , improvment and interface
Installation
1.Run
composer require zezont4/laravel-acl
2.Add service provider & Aliases to /config/app.php file.
'providers' => [ \\ Other Providers, Zezont4\ACL\ACLServiceProvider::class, Collective\Html\HtmlServiceProvider::class, ], 'aliases' => [ \\ Other Aliases, 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class, ],
3.Add acl middleware to **app\Http\Kernel.php **
protected $routeMiddleware = [ \\ Other routeMiddleware, 'acl' => \Zezont4\ACL\Http\Middleware\CheckPermission::class, ];
4.use UserTrait app\User.php
class User extends Authenticatable { use \Zezont4\ACL\Models\UserTrait; \\ the rest of the class }
5.Publish assets and config file
php artisan vendor:publish --provider="Zezont4\ACL\ACLServiceProvider" --tag="config" --tag="assets"
6.Use it like this in your routs
Route::get('/users', [ 'middleware' => 'acl:manage_user', 'as' => 'users.all', 'uses' => 'UserController@index' ]);
Blade directive
@hasRole('manager') .... @endhasRole
Credits
License
The MIT License (MIT). Please see License File for more information.