PHP code example of italofantone / role-ladder

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

    

italofantone / role-ladder example snippets




use Illuminate\Support\Facades\Route;
use Italofantone\RoleLadder\Http\Middleware\RoleLadderMiddleware;

Route::middleware('auth:sanctum')->group(function () {
    Route::middleware(RoleLadderMiddleware::class.':admin')->group(function () {
        Route::get('/test-role-admin', function () {
            return 'This route is only for admins!';
        });
    });
});

php artisan vendor:publish --tag=role-ladder-config