Laravel Access Control List

dev-master 2021-12-25 04:14 UTC

This package is auto-updated.

Last update: 2025-03-25 11:13:10 UTC


README

Maintained by Hitechra Engineer Team

Access Control List made easy

Installation

Run composer command

composer require hitechra-shared-lib-laravel/acl

Publish migration and config

php artisan vendor:publish --provider="HitechraSharedLibLaravel\Acl\ServiceProvider"

Usage

Use HitechraSharedLibLaravel\Acl\HasRole Trait to User model

    class User extends Authenticatable
    {
        ...
        use \HitechraSharedLibLaravel\Acl\HasRole;

Assign Role

    $user->assignRole('admin');

Revoke Role

    $user->revokeRole('admin');

Get Roles Collection

    $user->roles;

Check if user has a role

    $user->is_a('admin');

Create new role

    createRole('role_name', 'Role Title');