mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 11:34:03 +00:00
Fix exempt routes, explain them in README
This commit is contained in:
parent
7b95a9a4cd
commit
a9750ee6d8
2 changed files with 11 additions and 6 deletions
13
README.md
13
README.md
|
|
@ -71,10 +71,13 @@ protected function mapTenantRoutes()
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
And add this line to `map()`:
|
And add this to `map()`:
|
||||||
|
|
||||||
```php
|
```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.
|
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]`.
|
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`
|
#### `database`
|
||||||
|
|
||||||
Databases will be named like this:
|
Databases will be named like this:
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,6 @@ class InitializeTenancy
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
if (in_array($request->getHost(), config('tenancy.exempt_domains', []))) {
|
|
||||||
return $next($request);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
tenancy()->init();
|
tenancy()->init();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue