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 Backend Engineer
Remote
64 Robots
Senior Laravel Developer
Atlanta, GA
Helium LLC
Full-Stack Developer (JS - Vue.js, PHP - Laravel)
US Remote / Telecommute
TTEC Digital
Backend Engineer
Brooklyn, NY
Stationhead
Back-End Developer
Orlando, FL
Christ for all Nations
Senior Software Developer
Nashville, TN
Bernard Health
Full Stack PHP Developer – (Laravel & Vue.js) - local only
Salt Lake City, Utah
Swell