emptynick / voyager-permissions
Permission system for Voyager II using spatie/laravel-permission
Installs: 31
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
Language:Vue
Requires
- spatie/laravel-permission: ^5.3
- voyager-admin/voyager: 2.x-dev
This package is auto-updated.
Last update: 2024-11-23 22:01:27 UTC
README
This plugin for Voyager II implements spaties laravel-permission to authorize actions and users.
Getting started
Require the package
First, require the plugin: composer require emptynick/voyager-permissions
.
Run the installer
Run the installer by calling php artisan permissions:install
.
Publishing migrations and config file
First the installer will publish a configuration file and migrations.
After that you will be asked if you want to migrate now.
If you want to change the published migrations select No
and run the command again after you finished editing.
Add the HasRole Trait to your user model
The the installer will ask you to open your user model and add the trait Emptynick\Permissions\Traits\HasRoles
:
<?php namespace App\Models; use Illuminate\Foundation\Auth\User as Authenticatable; use Emptynick\Permissions\Traits\HasRoles; class User extends Authenticatable { use HasRoles; // ... }
Add necessary permissions
In order to be allowed to open the permission manager, the installer will add some required permissions to your user.
Enter your user model (normally \App\Models\User
) hit enter and enter the ID of your user.
Thats it! Now you are able to access the Permission
page from the menu.