This package uses routes to separate the tenant part of the application from the central part of the application. The central part will commonly include a landing page, sign up form, and some sort of dashboard.
Routes in the
routes/web.php file are the central routes. When they are visited, tenancy is not intialized and any model, cache call, controller, job dispatch, Redis call and anything else that is called in during this request will be central.
However, since you don't want routes related to the app on your main domain and sign up forms on tenant domains, you must also define what domains host the central stuff in the
The exempt domains should not include the protocol. For example, you should include
example.com rather than
Using central things inside the tenant app
To use central things (databases/caches/Redis connections/filesystems/...) on special places of your tenant app, you may do the following.
Create a new connection and use it like
If you want to use models, create a
getConnectionName() method that returns the name of the central connection
Create a new connection, don't put it into
tenancy.redis.prefixed_connections, and use it like
GlobalCache facade, or the
Create a disk and don't add it to
Mix is intended for template-related assets and as such, it's not scoped to the current tenant.
Alternatively, the package provides a
global_asset() helper which is a non-tenant-aware replacement for
asset(), in case you don't want to use
It's recommended to use
mix() though, due to its features such as version tagging.
Create a new queue connection with the
central key set to