PHPackages                             insenseanalytics/laravel-nova-permission - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. insenseanalytics/laravel-nova-permission

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

insenseanalytics/laravel-nova-permission
========================================

A Laravel Nova tool for Spatie's Permission library.

v1.0(5y ago)7549.0k—0%32[7 issues](https://github.com/insenseanalytics/laravel-nova-permission/issues)MITPHPPHP &gt;=7.1.0

Since Nov 10Pushed 5y ago4 watchersCompare

[ Source](https://github.com/insenseanalytics/laravel-nova-permission)[ Packagist](https://packagist.org/packages/insenseanalytics/laravel-nova-permission)[ RSS](/packages/insenseanalytics-laravel-nova-permission/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

A Laravel Nova tool for the Spatie Permission package
=====================================================

[](#a-laravel-nova-tool-for-the-spatie-permission-package)

[![License](https://camo.githubusercontent.com/23ddb33963b200680d9064fa35a9263a5eb31cb13f91586c3785325605fbdb81/68747470733a2f2f706f7365722e707567782e6f72672f696e73656e7365616e616c79746963732f6c61726176656c2d6e6f76612d7065726d697373696f6e2f6c6963656e7365)](https://packagist.org/packages/insenseanalytics/laravel-nova-permission)[![Latest Stable Version](https://camo.githubusercontent.com/79859bdd6f58f675902578ceeb3ba16bbca0a9a4ea3e76afb232f10af6946cf7/68747470733a2f2f706f7365722e707567782e6f72672f696e73656e7365616e616c79746963732f6c61726176656c2d6e6f76612d7065726d697373696f6e2f762f737461626c65)](https://packagist.org/packages/insenseanalytics/laravel-nova-permission)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e4f41c505feaead7bd4dd3992998881a6caf091e5402c16bf06a42099c525c33/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f696e73656e7365616e616c79746963732f6c61726176656c2d6e6f76612d7065726d697373696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/insenseanalytics/laravel-nova-permission/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/c9c71f9882cfad2875171d7648ee11f59fe1559be4960172dde9a048db8753d3/68747470733a2f2f706f7365722e707567782e6f72672f696e73656e7365616e616c79746963732f6c61726176656c2d6e6f76612d7065726d697373696f6e2f646f776e6c6f616473)](https://packagist.org/packages/insenseanalytics/laravel-nova-permission)

This [Nova](https://nova.laravel.com) tool lets you:

- manage roles and permissions on the Nova dashboard
- use permissions based authorization for Nova resources

Screenshots
-----------

[](#screenshots)

[![screenshot of the backup tool](https://camo.githubusercontent.com/5f3323f0df623dfb9843cd097c8417f6574764a8d3db0fce391cfd955784b718/68747470733a2f2f696e73656e7365616e616c79746963732e6769746875622e696f2f7075626c69632d6173736574732f6c61726176656c2d6e6f76612d7065726d697373696f6e2f6e6f76612d7065726d697373696f6e2d73637265656e73686f742e706e67)](https://camo.githubusercontent.com/5f3323f0df623dfb9843cd097c8417f6574764a8d3db0fce391cfd955784b718/68747470733a2f2f696e73656e7365616e616c79746963732e6769746875622e696f2f7075626c69632d6173736574732f6c61726176656c2d6e6f76612d7065726d697373696f6e2f6e6f76612d7065726d697373696f6e2d73637265656e73686f742e706e67)

Requirements &amp; Dependencies
-------------------------------

[](#requirements--dependencies)

There are no PHP dependencies except the [Laravel Nova](https://nova.laravel.com) package and the [Spatie Permission](https://github.com/spatie/laravel-permission) package.

Installation
------------

[](#installation)

You can install this tool into a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require insenseanalytics/laravel-nova-permission
```

Next, if you do not have package discovery enabled, you need to register the provider in the `config/app.php` file.

```
'providers' => [
    ...,
    Insenseanalytics\LaravelNovaPermission\NovaPermissionServiceProvider::class,
]
```

Next, 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 [
        // ...
        \Insenseanalytics\LaravelNovaPermission\LaravelNovaPermission::make(),
    ];
}
```

Next, add `MorphToMany` fields to your `app/Nova/User` resource:

```
use Laravel\Nova\Fields\MorphToMany;

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

Finally, add the `ForgetCachedPermissions` class to your `config/nova.php` middleware like so:

```
// in config/nova.php
'middleware' => [
	'web',
	Authenticate::class,
	DispatchServingNovaEvent::class,
	BootTools::class,
	Authorize::class,
	\Insenseanalytics\LaravelNovaPermission\ForgetCachedPermissions::class,
],
```

Localization
------------

[](#localization)

You can use the artisan command line tool to publish localization files:

```
php artisan vendor:publish --provider="Insenseanalytics\LaravelNovaPermission\NovaPermissionServiceProvider"
```

Using Custom Role/Permission Resource Classes
---------------------------------------------

[](#using-custom-rolepermission-resource-classes)

If you want to use custom resource classes you can define them when you register a tool:

```
// in app/Providers/NovaServiceProvider.php

public function tools()
{
    return [
        // ...
        \Insenseanalytics\LaravelNovaPermission\LaravelNovaPermission::make()
            ->roleResource(CustomRole::class)
            ->permissionResource(CustomPermission::class),
    ];
}
```

Permissions Based Authorization for Nova Resources
--------------------------------------------------

[](#permissions-based-authorization-for-nova-resources)

By default, Laravel Nova uses Policy based authorization for Nova resources. If you are using the Spatie Permission library, it is very likely that you would want to swap this out to permission based authorization without the need to define Authorization policies.

To do so, you can use the `PermissionsBasedAuthTrait` and define a `permissionsForAbilities` static array property in your Nova resource class like so:

```
// in app/Nova/YourNovaResource.php

class YourNovaResource extends Resource
{
    use \Insenseanalytics\LaravelNovaPermission\PermissionsBasedAuthTrait;

    public static $permissionsForAbilities = [
      'all' => 'manage products',
    ];
}
```

The example above means that all actions on this resource can be performed by users who have the "manage products" permission. You can also define separate permissions for each action like so:

```
    public static $permissionsForAbilities = [
      'viewAny' => 'view products',
      'view' => 'view products',
      'create' => 'create products',
      'update' => 'update products',
      'delete' => 'delete products',
      'restore' => 'restore products',
      'forceDelete' => 'forceDelete products',
      'addAttribute' => 'add product attributes',
      'attachAttribute' => 'attach product attributes',
      'detachAttribute' => 'detach product attributes',
    ];
```

### Relationships

[](#relationships)

To allow your users to specify a relationship on your model, you will need to add another permission on the Model. For example, if your `Product` belongs to `User`, add the following permission on `app/Nova/User.php`. :

```
    public static $permissionsForAbilities = [
      'addProduct' => 'add user on products'
    ];
```

Contributing
------------

[](#contributing)

Contributions are welcome and will be fully credited as long as you use PSR-2, explain the issue/feature that you want to solve/add and back your code up with tests. Happy coding!

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.txt) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~348 days

Total

3

Last Release

2044d ago

Major Versions

v0.1.2 → v1.02020-10-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/d3b4395cbe0ac91e6c75a298f834f347905a340bd030e5f2046249a341569fee?d=identicon)[paras-malhotra](/maintainers/paras-malhotra)

---

Top Contributors

[![paras-malhotra](https://avatars.githubusercontent.com/u/16099046?v=4)](https://github.com/paras-malhotra "paras-malhotra (20 commits)")[![flashadvocate](https://avatars.githubusercontent.com/u/7848492?v=4)](https://github.com/flashadvocate "flashadvocate (1 commits)")

---

Tags

laravelnovapermissionsspatiespatielaravelnovalaravel-permission

### Embed Badge

![Health badge](/badges/insenseanalytics-laravel-nova-permission/health.svg)

```
[![Health](https://phpackages.com/badges/insenseanalytics-laravel-nova-permission/health.svg)](https://phpackages.com/packages/insenseanalytics-laravel-nova-permission)
```

###  Alternatives

[itsmejoshua/novaspatiepermissions

Laravel Nova tool for managing spaties roles/permissions in laravel's nova package.

30262.5k](/packages/itsmejoshua-novaspatiepermissions)[sereny/nova-permissions

Laravel Nova - Roles &amp; Permissions

86388.6k1](/packages/sereny-nova-permissions)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
