2017 © Pedro Peláez
 

library acl

Basic Laravel ACL

image

laravolt/acl

Basic Laravel ACL

  • Saturday, July 14, 2018
  • by uyab
  • Repository
  • 5 Watchers
  • 4 Stars
  • 1,808 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 24 Versions
  • 3 % Grown

The README.md

laravolt/acl

Installation

Composer

composer require laravolt/acl, (*1)

Service Provider

Skip this step if you are using Laravel 5.5 or above., (*2)

Laravolt\Acl\ServiceProvider::class,, (*3)

Migrations

Publish migration file (optional):, (*4)

php artisan vendor:publish --provider="Laravolt\Acl\ServiceProvider" --tag=migrations, (*5)

Run migration:, (*6)

php artisan migrate, (*7)

Publish Configuration (Optional)

php artisan vendor:publish --provider="Laravolt\Acl\ServiceProvider" --tag=config, (*8)

Usage

Add Laravolt\Acl\Traits\HasRoleAndPermission trait to User model:, (*9)

<?php

namespace App;

use Laravolt\Acl\Traits\HasRoleAndPermission;

class User
{
    use HasRoleAndPermission;
}

After that, User will have following methods:, (*10)

$user->roles()

Relationships that defines User has many Laravolt\Acl\Models\Role., (*11)

$user->hasRole($role, $checkAll = false)

Check if specific User has one or many roles. Return boolean true or false., (*12)

$user->assignRole($role)

Assign one or many roles to specific User. Possible values for $role are: id, array of id, role name, Role object, or array of Role object., (*13)

$user->revokeRole($role)

Revoke/remove one or many roles from specific User. Possible values for $role are: id, array of id, role name, Role object, or array of Role object., (*14)

$user->hasPermission($permission, $checkAll = false)

Check if specific User has one or many permissions. Return boolean true or false., (*15)

Command

php artisan laravolt:acl:sync-permission, (*16)

Bypass Authorization

You can bypass authorization checking using Laravel built-in method:, (*17)

// Place it somewhere before application running, e.g. in `AppServiceProvider`.
Gate::before(function($user){
    // check if $user superadmin
    // and then return true to skip all authorization checking
});

The Versions

14/07 2018

dev-master

9999999-dev https://github.com/laravolt/acl

Basic Laravel ACL

  Sources   Download

MIT

The Requires

 

The Development Requires

acl laravolt

20/12 2017

3.3.0

3.3.0.0 https://github.com/laravolt/acl

Basic Laravel ACL

  Sources   Download

MIT

The Requires

 

acl laravolt

28/11 2017

3.2.0

3.2.0.0 https://github.com/laravolt/acl

Basic Laravel ACL

  Sources   Download

MIT

The Requires

 

acl laravolt

16/08 2017

3.1.0

3.1.0.0 https://github.com/laravolt/acl

Basic Laravel ACL

  Sources   Download

MIT

The Requires

 

The Development Requires

acl laravolt

27/07 2017

3.0.0

3.0.0.0 https://github.com/laravolt/acl

Basic Laravel ACL

  Sources   Download

MIT

The Requires

 

The Development Requires

acl laravolt

12/05 2017
06/01 2017
29/12 2016
14/12 2016
02/12 2016
29/11 2016
28/11 2016
09/11 2016
21/09 2016
04/08 2016

1.x-dev

1.9999999.9999999.9999999-dev https://github.com/laravolt/acl

Basic Laravel ACL

  Sources   Download

MIT

The Requires

 

The Development Requires

acl laravolt

04/08 2016
27/07 2016

2.x-dev

2.9999999.9999999.9999999-dev https://github.com/laravolt/acl

Basic Laravel ACL

  Sources   Download

MIT

The Requires

 

The Development Requires

acl laravolt

27/07 2016
13/01 2016
13/01 2016
06/01 2016
23/12 2015

0.x-dev

0.9999999.9999999.9999999-dev https://github.com/laravolt/acl

Basic Laravel ACL

  Sources   Download

MIT

The Requires

 

The Development Requires

acl laravolt

23/12 2015
22/12 2015