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

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

oscillas/novaspatiepermissions
==============================

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

2.0.2(1y ago)02.7k1MITPHPPHP ^8.0

Since Nov 14Pushed 1y agoCompare

[ Source](https://github.com/oscillas/novaspatiepermissions)[ Packagist](https://packagist.org/packages/oscillas/novaspatiepermissions)[ RSS](/packages/oscillas-novaspatiepermissions/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (2)Versions (5)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 oscillas/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

36

—

LowBetter than 79% of packages

Maintenance49

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84% 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 ~192 days

Total

4

Last Release

379d ago

Major Versions

1.0.0 → 2.0.02025-01-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/76b77a50604542f5e1b82482305be1545d718d37b610f0b5af6b1781d65aa6f7?d=identicon)[jrgilman](/maintainers/jrgilman)

---

Top Contributors

[![notdone-au](https://avatars.githubusercontent.com/u/78652562?v=4)](https://github.com/notdone-au "notdone-au (21 commits)")[![ijpatricio](https://avatars.githubusercontent.com/u/26031459?v=4)](https://github.com/ijpatricio "ijpatricio (1 commits)")[![jrgilman](https://avatars.githubusercontent.com/u/6265723?v=4)](https://github.com/jrgilman "jrgilman (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/oscillas-novaspatiepermissions/health.svg)

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

###  Alternatives

[itsmejoshua/novaspatiepermissions

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

30270.6k](/packages/itsmejoshua-novaspatiepermissions)[chiiya/filament-access-control

Admin user, role and permission management for Laravel Filament

21851.1k](/packages/chiiya-filament-access-control)[insenseanalytics/laravel-nova-permission

A Laravel Nova tool for Spatie's Permission library.

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

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

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

PHPackages © 2026

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