Configuration
switchTenant()
Signature
Section titled “Signature”switchTenant() — returns void
Available in: controller, model, mapper, migrator, migration, tabledefinition
Category: Multi-Tenancy
Description
Section titled “Description”Switches the active tenant mid-request. Throws if the current tenant is locked
(set by TenantResolver middleware) unless force is true.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
tenant | struct | yes | — | Struct with at minimum a dataSource key. Optional: id, config. |
force | boolean | no | false | If true, overrides the lock set by TenantResolver middleware. |