1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 20:14:03 +00:00

Fix exempt routes, explain them in README

This commit is contained in:
Samuel Štancl 2019-01-19 16:29:55 +01:00
parent 7b95a9a4cd
commit a9750ee6d8
2 changed files with 11 additions and 6 deletions

View file

@ -71,10 +71,13 @@ protected function mapTenantRoutes()
}
```
And add this line to `map()`:
And add this to `map()`:
```php
$this->mapTenantRoutes();
// Map tenant routes only if the current domain is not [exempt from tenancy](#exempt-domains).
if (! in_array(request()->getHost(), config('tenancy.exempt_domains', []))) {
$this->mapTenantRoutes();
}
```
Now rename the `routes/web.php` file to `routes/tenant.php`. This file will contain routes accessible only with tenancy.
@ -89,6 +92,12 @@ php artisan vendor:publish --provider='Stancl\Tenancy\TenancyServiceProvider' --
You should see something along the lines of `Copied File [...] to [/config/tenancy.php]`.
#### `exempt_domains`
Domains listed in this array won't have tenant routes.
For example, you can put the domain on which you have your landing page here.
#### `database`
Databases will be named like this:

View file

@ -22,10 +22,6 @@ class InitializeTenancy
*/
public function handle($request, Closure $next)
{
if (in_array($request->getHost(), config('tenancy.exempt_domains', []))) {
return $next($request);
}
try {
tenancy()->init();
} catch (\Exception $e) {