Seiten · Laravilt
Tenancy Best Practices
Tips and troubleshooting for tenant-aware panels.
Environment Configuration
env
Reserved Subdomains
Add any subdomains tenants must not claim in config/laravilt-tenancy.php:
php
Provisioning in the Background
For faster sign-ups, queue tenant database creation:
php
Tenant-Aware Queued Jobs
Queued jobs don't carry tenant context. Pass the tenant id and restore it:
php
Troubleshooting
User Has No Teams
- Check the User implements
HasTenantsandHasDefaultTenant - Check the User uses the
HasTeamstrait - Check
current_team_idis fillable - Verify the
team_userpivot table exists
Tenant Not Found
- Check
APP_DOMAINand the panel's tenant domain - Verify DNS (wildcard record) for subdomains
- Clear caches:
php artisan optimize:clear - Check the
domainstable entries
Database Connection Issues
- Verify the tenant connection template (
TENANT_DB_CONNECTION) - Check the tenant database exists (
php artisan tenants:migrate --tenant=<slug>) - Verify the database user can create databases