nekoos/laravel-permission-grouping

Permission handling for Laravel 6.0 and up

v0.1.0 2021-04-08 21:41 UTC

This package is auto-updated.

Last update: 2024-04-11 04:28:53 UTC


README

laravel-chameleon-access

Installing

You can install the package via composer:

composer require spatie/laravel-permission

Optional: The service provider will automatically get registered. Or you may manually add the service provider in your config/app.php file:

'providers' => [
    // ...
    NekoOs\ChameleonAccess\Providers\Initialize::class,
];

You should publish the migration and the config/permission.php config file with:

php artisan vendor:publish --provider="NekoOs\ChameleonAccess\Providers\Initialize"

Usage

First, add the NekoOs\ChameleonAccess\HasScopes trait to your User model(s):

use NekoOs\ChameleonAccess\HasScopes;

class User
{
    use HasScopes;

    // ...
}

Assigning Roles

A role can be assigned to any user by a scope:

$user->withScopeAssignRoles($model, 'writer');