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