mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-14 03:04:04 +00:00
Improved Documentation Search (#61)
* chore: (Improve documentation search for V3) * fix: checks for mispelled words * fix: mispelled words * fix spaces and syntax * Update multi-database-tenancy.blade.md Co-authored-by: Samuel Stancl <samuel.stancl@gmail.com>
This commit is contained in:
parent
0549607899
commit
a4645b3abd
42 changed files with 158 additions and 158 deletions
|
|
@ -4,11 +4,11 @@ extends: _layouts.documentation
|
|||
section: content
|
||||
---
|
||||
|
||||
# Routes
|
||||
# Routes {#routes}
|
||||
|
||||
This package has a concept of central routes and tenant routes. Central routes are only available on central domains, and tenant routes are only available on tenant domains. If you don't use domain identification, then all routes are always available and you may skip the details about preventing access from other domains.
|
||||
|
||||
## Central routes
|
||||
## Central routes {#central-routes}
|
||||
|
||||
You may register central routes in `routes/web.php` or `routes/api.php` like you're used to. However, you need to make one small change to your RouteServiceProvider.
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ protected function centralDomains(): array
|
|||
|
||||
Note: If you're using multiple central domains, you can't use route names, because different routes (= different combinations of domains & paths) can't share the same name. If you need to use a different central domain for testing, use `config()->set()` in your TestCase `setUp()`.
|
||||
|
||||
## Tenant routes
|
||||
## Tenant routes {#tenant-routes}
|
||||
|
||||
You may register tenant routes in `routes/tenant.php`. These routes have no middleware applied on them, and their controller namespace is specified in `app/Providers/TenancyServiceProvider`.
|
||||
|
||||
|
|
@ -70,12 +70,12 @@ You may do the same for the `api` route group, for instance.
|
|||
|
||||
Also, you may use different initialization middleware than the domain one. For a full list, see the [Tenant identification]({{ $page->link('tenant-identification') }}) page.
|
||||
|
||||
### Conflicting paths
|
||||
### Conflicting paths {#conflicting-paths}
|
||||
|
||||
Due to the order in which the service providers (and as such, their routes) are registered, tenant routes will take precedence over central routes. So if you have a `/` route in your `routes/web.php` file but also `routes/tenant.php`, the tenant route will be used on tenant domains.
|
||||
|
||||
However, tenant routes that don't have their central counterpart will still be accessible on central domains and will result in a "Tenant could not be identified on domain ..." error. To avoid this, use the `Stancl\Tenancy\Middleware\PreventAccessFromCentralDomains` middleware on all of your tenant routes. This middleware will abort with a 404 if the user is trying to visit a tenant route on a central domain.
|
||||
|
||||
## Universal routes
|
||||
## Universal routes {#universal-routes}
|
||||
|
||||
See the [Universal Routes feature]({{ $page->link('features/universal-routes') }}).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue