PHP code example of gabrielesbaiz / nova-spatie-permissions
1. Go to this page and download the library: Download gabrielesbaiz/nova-spatie-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/ */
gabrielesbaiz / nova-spatie-permissions example snippets
// in app/Providers/NovaServiceProvider.php
use Gabrielesbaiz\NovaSpatiePermissions\Novaspatiepermissions;
public function tools()
{
return [
// ...
Novaspatiepermissions::make(),
];
}
use Laravel\Nova\Fields\MorphToMany;
public function fields(Request $request)
{
return [
// ...
MorphToMany::make('Roles', 'roles', \Gabrielesbaiz\NovaSpatiePermissions\Role::class),
MorphToMany::make('Permissions', 'permissions', \Gabrielesbaiz\NovaSpatiePermissions\Permission::class),
];
}