PHP code example of codegor / laravel-acl

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

    

codegor / laravel-acl example snippets


'providers' => [

Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
...
Codegor\Acl\Providers\AclServiceProvider::class,

],
'aliases' => [

'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
...
'Acl' => Codegor\Acl\Facades\Acl::class
]

protected $routeMiddleware = [

....
'acl' => 'Codegor\Acl\Http\Middleware\Acl',

];

use Codegor\Acl\Traits\Acl;

class User extends Model
{
use ... Acl;
}

return [
  'config' => [
    'role_source' => 'config' // 'config' || 'DB'
	...
  ],
  'permissions' => [
      'admin' => (object) [
        'role' => 'admin',
        'type' => 'all allow', // or 'all deny'
        'list' => [] // if in table - need in json formate
      ],
	  ...
  ]
  'state' => [
    'admins' => [ // resourse
      'active' =>[ // status #1
        'activate'
      ],
      'inactive' =>[ // status #2
        'update'
      ],
    ],
    ...
  ]
];

$ php artisan vendor:publish --provider="Codegor\Acl\Providers\AclServiceProvider"