PHP code example of mradang / laravel-rbac

1. Go to this page and download the library: Download mradang/laravel-rbac 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/ */

    

mradang / laravel-rbac example snippets


use mradang\LaravelRbac\Traits\UserModelTrait;

$token = $user->createToken('app-name', $user->access)->plainTextToken;

Route::middleware(['auth:sanctum'])

Route::middleware(['auth:sanctum', 'rbac'])
bash
php artisan migrate:refresh
bash
php artisan rbac:MakeRouteDescFile
bash
php artisan rbac:RefreshRbacNode