Introduction
Filament’s tenancy features allow you to build multi-tenant applications where users can belong to one or more organizations, teams, or accounts. Resources and data are automatically scoped to the current tenant.Configuring tenancy
Enable tenancy by specifying the tenant model:Team model as the tenant.
Tenant slug attribute
By default, Filament uses the model’s route key. Specify a custom slug attribute:Ownership relationship
Define the relationship between users and tenants:team() relationship.
Tenant routing
Route prefix
Add a route prefix for tenant URLs:/team/{tenant}/admin.
Tenant domains
Use subdomains for tenants:acme.example.com, widgets.example.com, etc.
Tenant model setup
Your tenant model should define the relationship to users:User model setup
Your User model needs to define which tenants they can access:Scoping resources to tenants
Resources are automatically scoped to the current tenant if they belong to one.Enabling tenant scoping
Implement the tenant ownership relationship on your model:Custom tenancy scope name
If your relationship isn’t named after the tenant model:Disabling automatic scoping
Optionally disable automatic scoping for specific resources:Tenant switcher
The tenant switcher allows users to switch between tenants.Customizing the switcher
Hiding the tenant menu
Tenant registration
Allow users to create new tenants:Tenant profile
Allow users to edit tenant settings:Tenant menu items
Customize the tenant menu dropdown:Tenant billing
Integrate billing for tenants using a billing provider:BillingProvider contract:
Requiring subscriptions
Require active subscriptions to access tenants:Custom tenant resolution
Customize how tenants are resolved from route parameters:Accessing the current tenant
Access the current tenant from anywhere:Tenant-aware notifications
Notifications are automatically scoped to the current tenant when using database notifications.Resource creation hooks
Automatically set the tenant when creating records:Filament automatically handles this for you when your model has the correct tenant relationship defined.