mirror of
https://github.com/archtechx/tenancy.git
synced 2026-06-21 20:24:03 +00:00
1.4 KiB
1.4 KiB
Routing And Assets Reference
Use this when working with tenant routes, route modes, cloned routes, or tenant assets.
Source Files
assets/tenant_routes.stub.phpassets/TenancyServiceProvider.stub.phpassets/routes.phpsrc/Actions/CloneRoutesAsTenant.phpsrc/Enums/RouteMode.phpsrc/Controllers/TenantAssetController.php
Published Tenant Routes
The stub groups tenant routes with:
webInitializeTenancyByDomainPreventAccessFromUnwantedDomainsScopeSessions
The application TenancyServiceProvider loads routes/tenant.php under the tenant middleware group.
Route Modes
The package registers these middleware groups:
cloneuniversaltenantcentral
tenancy.default_route_mode defaults to central. Override per route using route mode middleware.
Asset Routes
When tenancy.routes is true, the package registers:
/tenancy/assets/{path?}namedstancl.tenancy.asset/{tenant}/tenancy/assets/{path?}namedtenant.stancl.tenancy.assetfor path identification
Rules
- Keep central and tenant routes explicit.
- Use
routes/tenant.phpfor tenant application routes when using the stub. - Use
universalonly for routes intended to work in both contexts. - Use
CloneRoutesAsTenantfor package route integration instead of manually duplicating route definitions. - Disable package routes only if using external storage or a custom asset controller.