PHP code example of luizfabianonogueira / acl-permissions
1. Go to this page and download the library: Download luizfabianonogueira/acl-permissions 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/ */
luizfabianonogueira / acl-permissions example snippets
use LuizFabianoNogueira\AclPermissions\AclPermissionsServiceProvider;
return [
...
AclPermissionsServiceProvider::class,
...
];
return [
/**
* Define the column type of the id in user table.
*/
'user_id_is' => 'UUID', # INTEGER or UUID
/**
* Define the column type of the id in user table.
*/
'role_id_is' => 'UUID', # INTEGER or UUID
/**
* The user model that should be used to retrieve your permissions.
*/
'user' => App\Models\User::class,
/**
* The role model that should be used to retrieve your permissions.
*/
'role' => null
];
use LuizFabianoNogueira\AclPermissions\Models\Role;
/**
* Get the roles for the user.
*/
public function roles(): BelongsToMany
{
return $this->belongsToMany(Role::class, 'role_user', 'user_id', 'role_id');
}
use LuizFabianoNogueira\AclPermissions\Services\AclPermissionService;
/**
* Bootstrap any application services.
*/
public function boot(): void
{
AclPermissionService::registerGates();
}