romegadigital/multitenancy-nova-tool
A Laravel Nova tool for multitenancy that helps you manage tenants and switch tenant context from within Nova, simplifying multi-tenant administration.
composer require romegadigital/multitenancy-nova-tool
Version 4.0.0 is the current line and targets Nova 4, Laravel 10, and PHP 8.1+. If you are on Nova 3 / Laravel 9 / PHP 8.0, pin ^3.0 instead — the 4.x constraints are not backward compatible.app/Providers/NovaServiceProvider.php:
public function tools()
{
return [
new \RomegaDigital\MultitenancyNovaTool\MultitenancyNovaTool(),
];
}
php artisan vendor:publish --provider="RomegaDigital\MultitenancyNovaTool\MultitenancyNovaToolServiceProvider"
composer.json of the tool for the exact multitenancy dependency (likely romegadigital/multitenancy or a compatible contract).vyuldashev/nova-permission with kiritokatklian/nova-permission (a maintained fork). If you already ship Nova permission tooling, confirm which one is installed before registering menus — see Gotchas.fields() method to add computed fields like tenant database size.canSee or tool authorization to restrict access to super‑admins. The tool is not intended to run inside tenant contexts.ProvisionTenantJob instead of the default database creation.kiritokatklian/nova-permission in the stack, gate the Tenants tool via roles/permissions rather than hard‑coded emails: seed a super-admin role, assign permissions such as view tenants / manage tenants, and check them in the tool’s canSee callback or a TenantPolicy. This is also the cleanest way to scope “who can create vs. who can only view”.Nova::tools() in the appropriate NovaServiceProvider.composer.json constraints — the release notes advertise additions, not removals.vyuldashev/nova-permission for kiritokatklian/nova-permission. Watch for:
vyuldashev/nova-permission. The fork typically replaces it; if not, you'll need to remove the old one explicitly.Vyuldashev\NovaPermission\NovaPermissionServiceProvider from config/app.php.roles/permissions tables and pivot data normally carry over unchanged (same schema lineage), but run migrations on a staging copy first.stancl/tenancy or another package, you will likely need to write an adapter or override the config to point to your models. Review the service provider bindings.config/database.php has the correct tenant connection and that the tool’s config points to it. A common failure is migrations running on the central DB instead of the tenant DB.php artisan nova:clear) and config cache (php artisan config:clear). Verify the tool is registered in the correct NovaServiceProvider and that the authenticated user passes the tool’s authorization (often viewNova plus a gate or permission check). After the permission-package swap, also clear the permission cache (php artisan permission:cache-reset, or your fork’s equivalent command) — stale permission caches are a frequent cause of “the tool vanished after upgrade”.TenantPolicy and register it in AuthServiceProvider to control who can create/delete tenants. Use Nova’s authorizedToViewAny on the resource if you override it.APP_DEBUG=true) and check storage/logs/laravel.log. If an action fails silently, wrap the underlying provisioning call in a try/catch and log the exception. Use php artisan tenancy:list (if using stancl) or the tool’s own artisan commands to inspect tenant state.4.0.0) or a fork in your own VCS so an unexpected constraint change can't take down your admin panel.How can I help you explore Laravel packages today?