mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:14:04 +00:00
Merge branch '1.x' of github.com:stancl/tenancy into 1.x
This commit is contained in:
commit
61c87ef08e
2 changed files with 3 additions and 7 deletions
|
|
@ -36,6 +36,8 @@ Open `app/Http/Kernel.php` and make the middleware top priority, so that it gets
|
||||||
```php
|
```php
|
||||||
protected $middlewarePriority = [
|
protected $middlewarePriority = [
|
||||||
\Stancl\Tenancy\Middleware\InitializeTenancy::class,
|
\Stancl\Tenancy\Middleware\InitializeTenancy::class,
|
||||||
|
// ...
|
||||||
|
];
|
||||||
```
|
```
|
||||||
|
|
||||||
When a tenant route is visited, but the tenant can't be identified, an exception is thrown. If you want to change this behavior, to a redirect for example, add this to your `app/Providers/AppServiceProvider.php`'s `boot()` method.
|
When a tenant route is visited, but the tenant can't be identified, an exception is thrown. If you want to change this behavior, to a redirect for example, add this to your `app/Providers/AppServiceProvider.php`'s `boot()` method.
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,7 @@ class InitializeTenancy
|
||||||
try {
|
try {
|
||||||
tenancy()->init();
|
tenancy()->init();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// Pass the exception to the onFail function if it takes any parameters.
|
($this->onFail)($e);
|
||||||
$callback = $this->onFail;
|
|
||||||
if ((new \ReflectionFunction($callback))->getNumberOfParameters() > 0) {
|
|
||||||
$callback($e);
|
|
||||||
} else {
|
|
||||||
$callback();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue