Add Permissions based authorization for your Nova installation via User-based Roles and Permissions. Roles are defined in the database whereas Permissions are defined in the code base.
Merged PR #23 from contributor @dmason30.
Fixed #12
made the group, display name, and description properties translatable.
Fixed the Role model which was replaced by AuthServiceProvider
Database table names now can be configured using the config file.
// in config/nova-permissions.php
<?php
return [
// ...
/*
|--------------------------------------------------------------------------
| Database table names
|--------------------------------------------------------------------------
| When using the "HasRoles" trait from this package, we need to know which
| table should be used to retrieve your roles. We have chosen a basic
| default value but you may easily change it to any table you like.
*/
'table_names' => [
'roles' => 'roles',
'role_permission' => 'role_permission',
'role_user' => 'role_user',
],
// ...
];
If you want to use your own role resource, you can define it when you register the tool:
// in app/Providers/NovaServiceProvider.php
// ...
use App\Nova\Role;
public function tools()
{
return [
// ...
\Pktharindu\NovaPermissions\NovaPermissions::make()
->roleResource(Role::class),
];
}
Then extend the Pktharindu\NovaPermissions\Nova\Role
in your role resource:
// in app/Nova/Role.php
use Pktharindu\NovaPermissions\Nova\Role as RoleResource;
class Role extends RoleResource
{
// ...
}