PHP code example of pollob666 / acl

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

    

pollob666 / acl example snippets


Pollob666\Acl\AclServiceProvider::class

$this->call(UserTableSeeder::class); //optional        
$this->call(RoleTableSeeder::class);
$this->call(ResourceTableSeeder::class);
$this->call(PermissionTableSeeder::class);
$this->call(UserRoleTableSeeder::class);

protected $commands = [
    \Pollob666\Acl\Commands\AclResource::class
];


/**
* @resource('able to see home')
* @allowRole('Default, Admin')
*/
public function index()
{
    return view('home');
}

'auth.acl' => \Pollob666\Acl\Middleware\AuthenticateWithAcl::class,        
'resource.maker' => \Pollob666\Acl\Middleware\ResourceMaker::class,

Route::group(['middleware' => ['resource.maker','auth.acl']], function () {    
    Route::get('/home', 'HomeController@index');    
});

@if(has_access('User\UserController@getIndex'))
OR
@if(has_access('UserController@getIndex'))
 
@if(has_group_access(['User-User','User-Role','User-Resource']))
OR
@if(has_group_access('User-User'))

{{ @nullsafe($obj->prop->value) }}

php artisan vendor:publish