omardavila / base-tenant-filament
Multi-tenant Filament scaffold with Store tenant, FilamentShield and Spatie Permission
Package info
github.com/Miocids/base-tenant-filament-package
pkg:composer/omardavila/base-tenant-filament
v1.0.0
2026-05-31 16:46 UTC
Requires
- php: ^8.2
- bezhansalleh/filament-shield: ^4.0
- filament/filament: ^5.0
- spatie/laravel-permission: ^6.0|^7.0
README
Multi-tenant Filament scaffold with Store as tenant, FilamentShield and Spatie Permission — wired up in one command.
Requirements
- PHP ^8.2
- Laravel ^11|^12|^13
- Filament ^5.0
- bezhansalleh/filament-shield ^4.0
- spatie/laravel-permission ^6.0|^7.0
Installation
composer require omardavila/base-tenant-filament
php artisan base-tenant:install
php artisan migrate
Done. Visit /admin and register your first store.
What base-tenant:install does
| Step | What changes |
|---|---|
| Publishes migrations | stores and store_users tables |
Configures config/permission.php |
teams: true, team_foreign_key: store_id |
Replaces app/Models/User.php |
Adds HasStores trait, implements FilamentUser + HasTenants |
Replaces app/Providers/Filament/AdminPanelProvider.php |
Wires tenant, registration page, Shield plugin with scopeToTenant(false), SyncShieldTenant middleware |
What you get
- Store as Filament tenant — users can belong to many stores and switch between them
- RegisterStore page — users without a store are redirected here automatically
- super_admin role created per store on registration — bypasses all Gate checks (sees everything)
- Spatie Permission teams scoped to
store_id— roles and permissions are isolated per store - FilamentShield roles excluded from tenant scoping — roles are global across the panel
Architecture
User ──< StoreUser >── Store (many-to-many, pivot with softDeletes)
Store ──< model_has_roles (via store_id team column in Spatie Permission)
Customizing
After install, all files live in your project — edit freely:
app/Models/Store.php— add fields, relationshipsapp/Models/User.php— extend as neededapp/Filament/Pages/Tenancy/RegisterStore.php— customize registration formapp/Providers/Filament/AdminPanelProvider.php— panel config
The package models (OmarDavila\BaseTenantFilament\Models\Store) are used internally. The published App\Models\Store takes precedence once you run install.
Publishing assets individually
# Only migrations php artisan vendor:publish --tag=base-tenant-migrations # Only config php artisan vendor:publish --tag=base-tenant-config
License
MIT