2017 © Pedro Peláez
 

library permissions

Laravel permissions handler

image

daltcore/permissions

Laravel permissions handler

  • Friday, April 13, 2018
  • by RamonSmit
  • Repository
  • 1 Watchers
  • 1 Stars
  • 328 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 23 % Grown

The README.md

Permissions

FOSSA Status, (*1)

Laravel permissions handler, on your own model, (*2)

Install

Via Composer, (*3)

``` bash $ composer require daltcore/laravel-permissions, (*4)


In your config/app.php at the Package Service Providers ``` php DALTCORE\Permissions\ServiceProvider::class,

In your config/app.php at the Class Aliases ``` php 'Permission' => DALTCORE\Permissions\Facade::class,, (*5)


In your app/Http/Kernel.php in $routeMiddleware ```php 'permission' => \DALTCORE\Permissions\Http\Middleware\CheckPermission::class, 'role' => \DALTCORE\Permissions\Http\Middleware\CheckRole::class,

Publish migrations, (*6)

php artisan vendor:publish --tag=dpm-migrations

Run migrations, (*7)

php artisan migrate

Add trait to User model, (*8)

use DALTCORE\Permissions\Traits\Permissible;

Usage

Add a role, (*9)

Permission::addRole('admin');

Add a permission, (*10)

Permission::addPermission('create-users', 'a small description');

Link permission to role, (*11)

Permission::addPermissionToRole('admin', 'create-users');

Link role to user, (*12)

User::find(1)->giveRole('admin');

Check if user has role, (*13)

User::find(1)->hasRole('admin');

Check if user has permission, (*14)

User::find(1)->hasPermission('create-users');

Drop role from user, (*15)

User::find(1)->dropRole('admin');

Drop permission from role, (*16)

Permission::dropPermissionFromRole('admin', 'create-users');

Remove a permission, (*17)

Permission::removePermission('admin');

Remove a role, (*18)

Permission::removeRole('admin');

Middleware

Route::group(['middleware' => 'permission:create-users'], function () {
...
Route::group(['middleware' => 'role:admin'], function () {

Blade directives

@hasrole('admin')
I'm admin
@else
I'm not admin
@endhasrole

@haspermission('create-users')
I can create users
@else
I cannot create users
@endhaspermission

License

The MIT License (MIT). Please see License File for more information., (*19)

FOSSA Status, (*20)

The Versions

13/04 2018

dev-master

9999999-dev https://github.com/daltcore/permissions

Laravel permissions handler

  Sources   Download

MIT

The Requires

 

laravel permissions daltcore

13/04 2018

v1.0.7

1.0.7.0 https://github.com/daltcore/permissions

Laravel permissions handler

  Sources   Download

MIT

The Requires

 

laravel permissions daltcore

13/04 2018

v1.0.6

1.0.6.0 https://github.com/daltcore/permissions

Laravel permissions handler

  Sources   Download

MIT

The Requires

 

laravel permissions daltcore

13/04 2018

v1.0.5

1.0.5.0 https://github.com/daltcore/permissions

Laravel permissions handler

  Sources   Download

MIT

The Requires

 

laravel permissions daltcore

30/09 2017

v1.0.4

1.0.4.0 https://github.com/daltcore/permissions

Laravel permissions handler

  Sources   Download

MIT

The Requires

 

laravel permissions daltcore

15/07 2017

v1.0.3

1.0.3.0 https://github.com/daltcore/permissions

Laravel permissions handler

  Sources   Download

MIT

The Requires

 

laravel permissions daltcore

15/07 2017

v1.0.2

1.0.2.0 https://github.com/daltcore/permissions

Laravel permissions handler

  Sources   Download

MIT

The Requires

 

laravel permissions daltcore

15/07 2017

v1.0.1

1.0.1.0 https://github.com/daltcore/permissions

Laravel permissions handler

  Sources   Download

MIT

The Requires

 

laravel permissions daltcore

14/07 2017

v1.0.0

1.0.0.0 https://github.com/daltcore/permissions

Laravel permissions handler

  Sources   Download

MIT

The Requires

 

laravel permissions daltcore