1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 16:24:04 +00:00

Add exempt domains

This commit is contained in:
Samuel Štancl 2019-01-19 14:49:42 +01:00
parent eaeeeb5046
commit 7b95a9a4cd
2 changed files with 11 additions and 2 deletions

View file

@ -8,7 +8,9 @@ class InitializeTenancy
{
public function __construct(Closure $onFail = null)
{
$this->onFail = $onFail ?: function ($e) { throw $e; };
$this->onFail = $onFail ?: function ($e) {
throw $e;
};
}
/**
@ -20,8 +22,12 @@ class InitializeTenancy
*/
public function handle($request, Closure $next)
{
if (in_array($request->getHost(), config('tenancy.exempt_domains', []))) {
return $next($request);
}
try {
tenancy()->init();
tenancy()->init();
} catch (\Exception $e) {
// Pass the exception to the onFail function if it takes any parameters.
$callback = $this->onFail;