PHP code example of ngiraud / laravel-acl

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

    

ngiraud / laravel-acl example snippets


NGiraud\ACL\ACLServiceProvider::class,

use NGiraud\ACL\UserACL;

class User extends Authenticatable {
    use Notifiable, UserACL;
}

protected $routeMiddleware = [
    ...
    'acl' => \NGiraud\ACL\Middleware\CheckPermission::class,
    ...
]

SUPERADMIN_USERS=1,2,3,4,5

Route::get('/admin/test', [ 'as' => 'admin.test', 'uses' => 'HomeController@test' ])->middleware('acl:manage_users');
shell
php artisan make:auth
shell
php artisan vendor:publish --tag=acl
composer dump-autoload
shell
php artisan migrate
php artisan db:seed --class=UserTableSeeder
php artisan db:seed --class=ACLSeeder