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