PHP code example of rohsyl / laravel-acl

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

    

rohsyl / laravel-acl example snippets


'providers' => [
    // ...
    rohsyl\LaravelAcl\ServiceProvider::class,
];

php artisan vendor:publish --provider="rohsyl\LaravelAcl\ServiceProvider"

php artisan make:migration create_group_user_table

$user->grantPermissions([
    'page' => ACL_READ,
    'user' => ACL_UPDATE
 ]);
$user->save();

$user->grantPermission('user', ACL_DENY);
$user->save();

$group->grantPermission('user', ACL_READ);
$group->save();

$group->grantPermissions([
    'user' => ACL_READ,
    'page' => ACL_UPDATE,
    'run_page_export' => ACL_ALLOW
]);
$group->save();

$group->revokePermission('user');
$group->save();

$group->revokePermissions(['user', 'run_page_export']);
$group->save();