Optional features
Features are classes that add optional functionality to the package — things that aren’t needed for the core tenancy logic, but are useful in some applications.
Unlike tenancy bootstrappers, features don’t do anything when tenancy is initialized or ended. They’re bootstrapped once, when the package’s service provider boots, and typically register some macro or callback.
The package comes with the following features:
CrossDomainRedirect: adds adomain()method to redirect responsesUserImpersonation: lets you impersonate users in the tenant appTelescopeTags: tags Telescope entries with the current tenantViteBundler: makes Vite generate asset paths usingglobal_asset()DisallowSqliteAttach: prevents SQLite connections from attaching other databases
All features are disabled by default. To enable a feature, uncomment it in the features section of the tenancy config:
'features' => [ // Stancl\Tenancy\Features\UserImpersonation::class, // Stancl\Tenancy\Features\TelescopeTags::class, // Stancl\Tenancy\Features\CrossDomainRedirect::class, // Stancl\Tenancy\Features\ViteBundler::class, // Stancl\Tenancy\Features\DisallowSqliteAttach::class,],You can also create your own features by implementing the Stancl\Tenancy\Contracts\Feature interface
and adding the class to this array.