Junges Laravel ACL

Junges Laravel ACL

Junges Laravel ACL is a package by Mateus Junges that helps you to associate users with permissions and permission groups.

This package stores permissions for users and groups (to which users may belong) in the database with the following core features:

  • Check a user for ACL permissions
  • Sync a user’s permissions
  • Sync a group’s permissions
  • Check permissions in the view layer with @can or provided custom directives

At the heart of this package is the UserTrait:

use Illuminate\Foundation\Auth\User as Authenticatable;
use Junges\ACL\Traits\UsersTrait;

class User extends Authenticatable
{
    use UserTrait;

    // 
}

You can sync user and group permissions with the syncPermissions() method:

// With permission id array:
$user->syncPermissions([1, 2, 4]);

// With permission slugs array:
$user->syncPermissions(['permission-slug-1', 'permission-slug-2']);

// With instance of permission model arrays:
$user->syncPermissions([Permission::find(1), Permission::find(2)]);

// Just as above you can sync group permissions. Here's the id version:
$group->syncPermissions([1, 2, 4]);

Check out the usage documentation for a complete list of methods and package capabilities. You can learn more about this package and check out the source code on GitHub at mateusjunges/laravel-acl.


Filed in: Laravel Packages


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Senior Laravel Engineer
Remote okay (must already live in USA)
Hawthorne Effect
Senior Software Engineer (Remote - Contract)
Remote
Koodi Systems
PHP Developer
Pittsburgh / Remote
Sequoia Waste Solutions
Software Developer
Eindhoven
Simac IDS
Application Developer Level II (CakePHP / MySql / Vue.js)
Lancaster, PA
Harbor Compliance
FULL STACK LARAVEL DEVELOPER
LONDON - WEST END
AMPERSAND HEATLH
Mid/Senior Laravel Developer - U.S. Only
Kenner, Louisiana
Profit Miner Technologies