dev-master
9999999-devLight-weight role-based permissions for Laravel 5 built in Auth system.
MIT
The Requires
by Tuva Ergun
laravel auth roles permissions eloquent security tuva tuva ergun
Light-weight role-based permissions for Laravel 5 built in Auth system.
Laravel Permission adds role based permissions to built in Auth System of Laravel 5. Permission middleware protects routes and even crud controller methods., (*1)
composer.json
and update your dependency with composer update
:"require": { ... "tuvaergun/permission": "~1.0@dev", ... },
config/app.php
.'providers' => [ 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', ... 'Tuva\Permission\PermissionServiceProvider', ],
$ php artisan vendor:publish --provider="Tuva\Permission\PermissionServiceProvider"
Use your own models. Once you publish, it publishes the configuration file where you can define your own models which should extend to Permission models., (*2)
app/Http/Kernel.php
.protected $routeMiddleware = [ .... 'permission' => 'Tuva\Permission\Middleware\HasPermission', ];
User
model.use Tuva\Permission\Traits\HasRole; class User extends Model implements AuthenticatableContract, CanResetPasswordContract { use Authenticatable, CanResetPassword, HasRole; }
Follow along the Wiki to find out more., (*3)
Here's the TODO list for the next release (2.0)., (*4)
June 14, 2015 (latest) * [x] Added backward compatibility to l5.0 for lists() method. * [x] Added Blade Template Extensions., (*5)
March 28, 2015
* [x] Added Role Scope to get all users having a specific role. e.g User::role('admin')->get();
will list all users having admin
role., (*6)
March 7, 2015
* [x] is()
and can()
methods now support comma for AND
and pipe as OR
operator. Or pass an operator as a second param. more information
* [x] You can bind multiple permissions together so they inherit ones permission. more information, (*7)
Support follows PSR-2 PHP coding standards, and semantic versioning., (*8)
Please report any issue you find in the issues page. Pull requests are welcome., (*9)
Light-weight role-based permissions for Laravel 5 built in Auth system.
MIT
laravel auth roles permissions eloquent security tuva tuva ergun