Skip to content

joecampo/nova-permission

 
 

Repository files navigation

A Laravel Nova tool for Spatie's laravel-permission library

Latest Version on Packagist Total Downloads

screenshot 1 screenshot 2 screenshot 3

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require vyuldashev/nova-permission

Go through the Installation section in order to setup laravel-permission.

Next up, you must register the tool with Nova. This is typically done in the tools method of the NovaServiceProvider.

// in app/Providers/NovaServiceProvider.php

// ...

public function tools()
{
    return [
        // ...
        new \Vyuldashev\NovaPermission\NovaPermissionTool(),
    ];
}

Finally, add MorphToMany fields to you app/Nova/User resource:

// ...
use Laravel\Nova\Fields\MorphToMany;

public function fields(Request $request)
{
    return [
        // ...
        MorphToMany::make('Roles', 'roles', \Vyuldashev\NovaPermission\Role::class),
        MorphToMany::make('Permissions', 'permissions', \Vyuldashev\NovaPermission\Permission::class),
    ];
}

Usage

A new menu item called "Permissions & Roles" will appear in your Nova app after installing this package.

About

A Laravel Nova tool for Spatie's laravel-permission library

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 87.4%
  • HTML 12.6%