Not allowed
- Branching on deployment shape inside Core runtime
if (isSingleTenant())and anything shaped like it- Falling back to a “default tenant” instead of an explicit context
- Direct landlord lookups from domains outside
Tenancy
Why no default tenant
A fallback turns a missing-context bug into a data-leak bug. Without it, code that forgets to establish context throws immediately, in development, on the first run. With it, the same code silently reads and writes another tenant’s rows, and the failure surfaces much later as data appearing where it should not. Failing fast is the cheaper failure.Why no mode branching
A mode flag means two runtimes sharing one codebase, where only one of them is exercised by any given test run. The branch that is not taken locally is the branch that breaks in production. Core has one runtime model: multi-tenant, context always present.Reaching landlord data
A domain that needs platform-level data takes a contract fromTenancy/Contracts. Direct DB::connection('landlord') stays inside Tenancy
infrastructure.
This keeps the number of places that know about the landlord connection small
enough to audit, and it means a domain can be tested against a fake rather than a
second live database.
Switching tenants
Switch throughTenantSwitcher::runForTenant(), and restore in a finally: