PHP code example of joshbrw / laravel-permission-manager

1. Go to this page and download the library: Download joshbrw/laravel-permission-manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

joshbrw / laravel-permission-manager example snippets


use Permissions;
use Joshbrw\LaravelPermissions\Permission;

class MyProvider extends ServiceProvider {
    public function boot()
    {
        Permissions::register('User', [
            new Permission('user.list', 'List Users', 'This allows a User to list other Users.'),
            new Permission('user.create', 'Create Users', 'This allows a User to create another User.'),
        ]);
    }
}

use Joshbrw\LaravelPermissions\Traits\RegistersPermissions;
use Joshbrw\LaravelPermissions\Permission;

class MyProvider extends ServiceProvider {
    use RegistersPermissions;
    
    public function boot()
    {
        $this->registerPermissions('User', [
            new Permission('user.list', 'List Users', 'This allows a User to list other Users.'),
            new Permission('user.create', 'Create Users', 'This allows a User to create another User.'),
        ]);
    }
}