What problem does it solve?
It solves the complexity of building multi-tenant Laravel applications by keeping central (non-tenant) and tenant-scoped (tenanted) logic separated while ensuring queries and background jobs run in the correct tenant context.
Core Features & Use Cases
- Central vs Tenanted organization: Separate actions and DTOs for tenant management and tenant-specific business logic.
- Tenant-aware data access: Ensure tenant scoping is applied to queries so models do not require explicit tenant_id handling.
- Tenant context-safe background jobs: Preserve tenant context when dispatching queued jobs using tenant-aware job patterns.
- Tenant identification and routing: Initialize tenancy by domain, subdomain, or request header, and route requests to central or tenant handlers.
- Testing support for both contexts: Provide test infrastructure that creates isolated tenant databases, manages transactions, and runs correct base test cases by directory.
Quick Start
Use the 0057-laravel-multi-tenancy skill to structure your Laravel project for Stancl Tenancy with central/tenanted actions, tenant-aware jobs, and directory-based test setup.