leek/filament-subtenant-scope
Adds second-level tenancy to Filament panels with a top-nav dropdown that scopes all Eloquent queries to a sub-tenant (region, location, department, etc.). Persists via session/URL and auto-filters resources, widgets, badges, and global search.
PanelServiceProvider) minimizes architectural drift.HasSubtenantScope) for models.scopes() array in the Filament panel configuration.
This minimal surface area reduces integration risk and aligns with Laravel’s "convention over configuration" philosophy.?subtenant=nyc), enabling:
@source directive is a standard Filament pattern, so no custom build tools are needed.->whereNull('deleted_at') being overridden).subtenant_id on all scoped models).SoftDeletes, Filterable)?subtenant table, or are there multiple sub-tenant types (e.g., "region" vs. "department")?subtenant_id columns in all scoped tables?PanelServiceProvider, so integration is stack-aligned.subtenant_id column (or equivalent).composer require leek/filament-subtenant-scope.@source directive (one-time change).npm run dev or npm run build.HasSubtenantScope trait to models requiring sub-tenant filtering.scopes() array in PanelServiceProvider:
->scopes([
'regions' => Region::class,
'departments' => Department::class,
]);
?subtenant=1).Company → Subtenant hierarchy).applySubtenantScope logic.subtenant_id to models (if missing).HasSubtenantScope to pilot models.scopes() array configuration and model traits.wire:model or Filament’s request handling.tntsearch/laravel-scout-tnt or Laravel Debugbar.dd($query->getQueryLog()) to inspect scoped queries.debug() helper to inspect panel state.subtenant_id is critical.How can I help you explore Laravel packages today?