PHP code example of njbm / role-permission

1. Go to this page and download the library: Download njbm/role-permission 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/ */

    

njbm / role-permission example snippets

bash
php artisan vendor:publish --provider="RolePermission\RolePermissionServiceProvider" --tag=config

bash
php artisan migrate

bash
php artisan db:seed --class="RolePermission\Seeders\RolePermissionSeeder"

bash

'check.permission' => \RolePermission\Middleware\CheckPermission::class,

bash

'check.permission' => \RolePermission\Middleware\CheckPermission::class,

bash

Blade::if('canDo', function ($permission) {
    return \AccessControl::can($permission);
});

bash

return [
    'default_roles' => [
        'admin' => [
            'edit address',
            'delete address',
            'view dashboard',
        ],
        'editor' => [
            'edit address',
        ],
    ],
];