PHPackages                             romegadigital/multitenancy-nova-tool - 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. [Admin Panels](/categories/admin)
4. /
5. romegadigital/multitenancy-nova-tool

AbandonedArchivedLibrary[Admin Panels](/categories/admin)

romegadigital/multitenancy-nova-tool
====================================

A Laravel Nova tool to manage multitenancy.

4.0.0(2y ago)679.0k↓55.6%5[2 issues](https://github.com/romegasoftware/MultitenancyNovaTool/issues)MITPHPPHP ^8.0

Since Jan 22Pushed 2y ago5 watchersCompare

[ Source](https://github.com/romegasoftware/MultitenancyNovaTool)[ Packagist](https://packagist.org/packages/romegadigital/multitenancy-nova-tool)[ RSS](/packages/romegadigital-multitenancy-nova-tool/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (0)

Multitenancy Nova Tool
======================

[](#multitenancy-nova-tool)

[![Total Downloads](https://camo.githubusercontent.com/dc17ff4b3720c29825f77fef311cc3731e1dcce8d08ece1fc114178c784349bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f6d6567616469676974616c2f6d756c746974656e616e63792d6e6f76612d746f6f6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/romegadigital/multitenancy-nova-tool)

This package is meant to integrate with the [Multitenancy Package](https://github.com/romegadigital/Multitenancy) to bring multitenancy functionality and management to [Laravel's Nova](https://nova.laravel.com).

This package automatically includes the Multitenancy Package as a dependency. Please read the documentation on how to integrate it with your existing app.

- [Multitenancy Nova Tool](#multitenancy-nova-tool)
    - [Installation](#installation)
    - [Usage](#usage)
    - [Define Inverse Relationships](#define-inverse-relationships)
    - [Middleware](#middleware)
    - [Policies](#policies)
    - [To Do](#to-do)

[![index](https://user-images.githubusercontent.com/10154100/51259066-b21f2b80-19ab-11e9-8fac-b3ee5c20c1c2.png)](https://user-images.githubusercontent.com/10154100/51259066-b21f2b80-19ab-11e9-8fac-b3ee5c20c1c2.png)

[![create](https://user-images.githubusercontent.com/10154100/51259176-e85cab00-19ab-11e9-89e4-3474d38504dd.png)](https://user-images.githubusercontent.com/10154100/51259176-e85cab00-19ab-11e9-89e4-3474d38504dd.png)

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

[](#installation)

Install the package via Composer:

```
composer require romegadigital/multitenancy-nova-tool
```

Then follow the [Installation](https://github.com/romegadigital/Multitenancy#installation) instructions to set up the Multitenancy Package.

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 [
        // ...
        new \RomegaDigital\MultitenancyNovaTool\MultitenancyNovaTool,
    ];
}
```

This package requires `Super Administrator` or `access admin` permissions. This can be added either through the included permission management tool under "Roles &amp; Permissions" or through our [assign super-admin command](https://github.com/romegadigital/Multitenancy#console-commands).

> **Hint**If you already executed `multitenancy:install`, a role with the name `Super Administrator` and a permission `access admin` attached was already created. Therefore you only need to add the role to a user.
>
> ```
> php artisan multitenancy:super-admin admin@example.com
> ```

Usage
-----

[](#usage)

New menu items labeled "Multitenancy" and "Roles &amp; Permissions" will appear in your Nova app after installing this package.

To see the Tenant relation in the user detail view, add a `BelongsToMany` field to your `app/Nova/User` resource:

```
// in app/Nova/User.php

use Laravel\Nova\Fields\BelongsToMany;

public function fields(Request $request)
{
    return [
        // ...
        BelongsToMany::make('Tenants', 'tenants', \RomegaDigital\MultitenancyNovaTool\Tenant::class),
    ];
}
```

On each Nova resource that is tenantable, a `BelongsTo` field is required in order to see the relation to the `Tenant` model:

```
use Laravel\Nova\Fields\BelongsTo;

public function fields(Request $request)
{
    return [
        // ...
        BelongsTo::make('Tenants', 'tenant', \RomegaDigital\MultitenancyNovaTool\Tenant::class),
    ];
}
```

Define Inverse Relationships
----------------------------

[](#define-inverse-relationships)

In order to display all related data to the `Tenant` model, you need to first implement a `Tenant` model that extends the package's provided model.

```
// in app/Tenant.php

namespace App\Models;

use RomegaDigital\Multitenancy\Models\Tenant as TenantModel;

class Tenant extends TenantModel
{
    // ... define relationships
    public function products()
    {
        return $this->hasMany(\App\Product::class);
    }
}
```

Next, update your config file to point to your new model.

```
// in config/multitenancy.php

// ...
'tenant_model' => \App\Models\Tenant::class,
```

Then create a Tenant Nova resource that extends the package's resource.

```
// in app/Nova/Tenant.php

namespace App\Nova;

use Illuminate\Http\Request;
use Laravel\Nova\Fields\HasMany;
use RomegaDigital\MultitenancyNovaTool\Tenant as TenantResource;

class Tenant extends TenantResource
{
    public static $model = \App\Models\Tenant::class;

    /**
    * Get the fields displayed by the resource.
    *
    * @param  \Illuminate\Http\Request  $request
    * @return array
    */
    public function fields(Request $request)
    {
        return array_merge(parent::fields($request),
        [
            // ... define relationships
            HasMany::make('Products'),
        ]);
    }

}
```

Middleware
----------

[](#middleware)

To scope Nova results to the Tenant being utilized, add the middleware to Nova:

```
// in config/nova.php

// ...

'middleware' => [
    // ...
    \RomegaDigital\Multitenancy\Middleware\TenantMiddleware::class,
    \Vyuldashev\NovaPermission\ForgetCachedPermissions::class,
],
```

Accessing Nova at the `admin` subdomain will remove scopes and display all results. Only users given the correct permissions, such as `Super Administrator`, will be able to access this subdomain.

Policies
--------

[](#policies)

By default, the Multitenancy resource will only be visible on the `admin` subdomain to users with appropriate access to this subdomain. You may override the policy to allow more access to the resource by defining a policy within your project. And then within your `AuthServiceProvider`, register the policy:

```
// in app/Providers/AuthServiceProvider.php

// ...
protected $policies = [
    // ...
    \RomegaDigital\Multitenancy\Models\Tenant::class => \App\Policies\TenantPolicy::class,
];
```

You can override the Permission and Role model policies by setting the policy file up in you `config/multitenancy.php` file. Look for `policies.role` and `policies.permission`.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~318 days

Recently: every ~341 days

Total

6

Last Release

1074d ago

Major Versions

1.0.0 → 2.0.02019-09-05

2.0.2 → 3.0.02021-01-27

3.0.0 → 4.0.02023-05-31

PHP version history (2 changes)1.0.0PHP &gt;=7.1.0

4.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/219298?v=4)[Braden Keith](/maintainers/bradenkeith)[@bradenkeith](https://github.com/bradenkeith)

---

Top Contributors

[![bradenkeith](https://avatars.githubusercontent.com/u/219298?v=4)](https://github.com/bradenkeith "bradenkeith (30 commits)")[![Naoray](https://avatars.githubusercontent.com/u/10154100?v=4)](https://github.com/Naoray "Naoray (5 commits)")

---

Tags

laravelmultitenancynova

### Embed Badge

![Health badge](/badges/romegadigital-multitenancy-nova-tool/health.svg)

```
[![Health](https://phpackages.com/badges/romegadigital-multitenancy-nova-tool/health.svg)](https://phpackages.com/packages/romegadigital-multitenancy-nova-tool)
```

###  Alternatives

[benjacho/belongs-to-many-field

belongsToMany nova representation in field.

158811.4k1](/packages/benjacho-belongs-to-many-field)[pdmfc/nova-action-button

A Laravel Nova field to run actions.

37733.0k1](/packages/pdmfc-nova-action-button)[khalin/nova-link-field

A Laravel Nova Link field.

31562.2k2](/packages/khalin-nova-link-field)[ebess/nova-collapsible-sidebar

A collapsible sidebar for Laravel Nova.

32313.2k](/packages/ebess-nova-collapsible-sidebar)

PHPackages © 2026

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