PHPackages                             itsmejoshua/novaspatiepermissions - 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. itsmejoshua/novaspatiepermissions

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

itsmejoshua/novaspatiepermissions
=================================

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

v1.0.7(4y ago)30262.5k↑37%33[5 issues](https://github.com/itsmejoshua/novaspatiepermissions/issues)[2 PRs](https://github.com/itsmejoshua/novaspatiepermissions/pulls)MITPHPPHP ^8.0

Since Apr 20Pushed 2y ago8 watchersCompare

[ Source](https://github.com/itsmejoshua/novaspatiepermissions)[ Packagist](https://packagist.org/packages/itsmejoshua/novaspatiepermissions)[ RSS](/packages/itsmejoshua-novaspatiepermissions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (7)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/670af82f03db2065fba499c8cbdf14f15f88bdca8d5c4e15a6e9a5c680bbbc48/68747470733a2f2f706f7365722e707567782e6f72672f6974736d656a6f736875612f6e6f76617370617469657065726d697373696f6e732f6c6963656e7365)](https://packagist.org/packages/insenseanalytics/laravel-nova-permission)[![Latest Stable Version](https://camo.githubusercontent.com/a50508c69d2a534ece74eb6597f76cf70ca2315a619389bcb095ce254bd90685/68747470733a2f2f706f7365722e707567782e6f72672f6974736d656a6f736875612f6e6f76617370617469657065726d697373696f6e732f762f737461626c65)](https://packagist.org/packages/itsmejoshua/novaspatiepermissions)[![Total Downloads](https://camo.githubusercontent.com/a59373886208675db7bc7a4e57fc1d9c9e853710a9c21ada2264b8e0e7eafcd8/68747470733a2f2f706f7365722e707567782e6f72672f6974736d656a6f736875612f6e6f76617370617469657065726d697373696f6e732f646f776e6c6f616473)](https://packagist.org/packages/itsmejoshua/novaspatiepermissions)

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](https://camo.githubusercontent.com/77ec3c49b0b5077fbb9eb6444a9def7fb51318cc83952c7a53294ceb1f81c4ef/68747470733a2f2f6974736d656a6f736875612e6f63686f737465642e61752d737964312e7570636c6f75646f626a656374732e636f6d2f4e6f76615370617469655065726d697373696f6e732e706e67)](https://camo.githubusercontent.com/77ec3c49b0b5077fbb9eb6444a9def7fb51318cc83952c7a53294ceb1f81c4ef/68747470733a2f2f6974736d656a6f736875612e6f63686f737465642e61752d737964312e7570636c6f75646f626a656374732e636f6d2f4e6f76615370617469655065726d697373696f6e732e706e67)

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

[](#requirements--dependencies)

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

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

[](#installation)

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

```
composer require itsmejoshua/novaspatiepermissions
```

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

```
'providers' => [
    ...,
    Itsmejoshua\Novaspatiepermissions\NovaSpatiePermissionsServiceProvider::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
use Itsmejoshua\Novaspatiepermissions\Novaspatiepermissions;

public function tools()
{
    return [
        // ...
        Novaspatiepermissions::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', \Itsmejoshua\Novaspatiepermissions\Role::class),
        MorphToMany::make('Permissions', 'permissions', \Itsmejoshua\Novaspatiepermissions\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,
	 \Itsmejoshua\Novaspatiepermissions\ForgetCachedPermissions::class,
],
```

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

[](#localization)

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

```
php artisan vendor:publish --provider=" \Itsmejoshua\Novaspatiepermissions\NovaPermissionServiceProvider"
```

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 \Itsmejoshua\Novaspatiepermissions\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, explain the issue/feature that you want to solve/add and back your code up with tests. Happy coding!

License
-------

[](#license)

This package was originally developed by  however they have abandoned the package. The MIT License (MIT). Please see [License File](LICENSE.txt) for more information.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.5% 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 ~5 days

Total

6

Last Release

1464d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60efcc9e75fde0dd69d9130c201164734cc9e01b70d4cbf92aa3a6c7c7eae906?d=identicon)[itsmejoshua](/maintainers/itsmejoshua)

---

Top Contributors

[![moroneyio](https://avatars.githubusercontent.com/u/78652562?v=4)](https://github.com/moroneyio "moroneyio (23 commits)")[![ijpatricio](https://avatars.githubusercontent.com/u/26031459?v=4)](https://github.com/ijpatricio "ijpatricio (1 commits)")[![roarkmccolgan](https://avatars.githubusercontent.com/u/1567162?v=4)](https://github.com/roarkmccolgan "roarkmccolgan (1 commits)")[![scouser03](https://avatars.githubusercontent.com/u/35454401?v=4)](https://github.com/scouser03 "scouser03 (1 commits)")

---

Tags

spatielaravelpermissionsnova

### Embed Badge

![Health badge](/badges/itsmejoshua-novaspatiepermissions/health.svg)

```
[![Health](https://phpackages.com/badges/itsmejoshua-novaspatiepermissions/health.svg)](https://phpackages.com/packages/itsmejoshua-novaspatiepermissions)
```

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[pktharindu/nova-permissions

Laravel Nova Grouped Permissions (ACL)

136387.1k](/packages/pktharindu-nova-permissions)[sereny/nova-permissions

Laravel Nova - Roles &amp; Permissions

86388.6k1](/packages/sereny-nova-permissions)[insenseanalytics/laravel-nova-permission

A Laravel Nova tool for Spatie's Permission library.

7549.0k](/packages/insenseanalytics-laravel-nova-permission)[wijzijnweb/laravel-inertia-permissions

Easy to use package to implement Spatie's Permissions package into Inertia Laravel projects.

193.9k](/packages/wijzijnweb-laravel-inertia-permissions)

PHPackages © 2026

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