PHP code example of codicastudio / permissions-manager
1. Go to this page and download the library: Download codicastudio/permissions-manager 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/ */
codicastudio / permissions-manager example snippets
// in app/Providers/NovaServiceProvider.php
// ...
public function tools()
{
return [
// ...
\Vyuldashev\NovaPermission\NovaPermissionTool::make(),
];
}
// in config/nova.php
'middleware' => [
// ...
\Vyuldashev\NovaPermission\ForgetCachedPermissions::class,
],
// ...
use Laravel\Nova\Fields\MorphToMany;
public function fields(Request $request)
{
return [
// ...
MorphToMany::make('Roles', 'roles', \Vyuldashev\NovaPermission\Role::class),
MorphToMany::make('Permissions', 'permissions', \Vyuldashev\NovaPermission\Permission::class),
];
}
// ...
use Vyuldashev\NovaPermission\PermissionBooleanGroup;
use Vyuldashev\NovaPermission\RoleBooleanGroup;
public function fields(Request $request)
{
return [
// ...
RoleBooleanGroup::make('Roles'),
PermissionBooleanGroup::make('Permissions'),
];
}
// ...
use Vyuldashev\NovaPermission\PermissionBooleanGroup;
use Vyuldashev\NovaPermission\RoleSelect;
public function fields(Request $request)
{
return [
// ...
RoleSelect::make('Role', 'roles'),
];
}
// in app/Providers/NovaServiceProvider.php
// ...
public function tools()
{
return [
// ...
\Vyuldashev\NovaPermission\NovaPermissionTool::make()
->roleResource(CustomRole::class)
->permissionResource(CustomPermission::class),
];
}
// ...
use Vyuldashev\NovaPermission\PermissionBooleanGroup;
use Vyuldashev\NovaPermission\RoleSelect;
public function fields(Request $request)
{
return [
// ...
RoleBooleanGroup::make('Roles', 'roles', null, 'description'),
PermissionBooleanGroup::make('Permissions', 'permissions', null, 'description'),
RoleSelect::make('Role', 'roles', null, 'description'),
];
}
// in app/Providers/NovaServiceProvider.php
// ...
public function tools()
{
return [
// ...
\Vyuldashev\NovaPermission\NovaPermissionTool::make()
->rolePolicy(RolePolicy::class)
->permissionPolicy(PermissionPolicy::class),
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.