23 lines
632 B
PHP
23 lines
632 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
|
|
|
|
class UniversalTenancy extends InitializeTenancyByDomain
|
|
{
|
|
public function handle($request, Closure $next)
|
|
{
|
|
// Check if the current host is a central domain
|
|
if (in_array($request->getHost(), config('tenancy.central_domains'))) {
|
|
// It's a central domain, skip tenancy initialization
|
|
return $next($request);
|
|
}
|
|
|
|
// It's a tenant domain, proceed with standard initialization
|
|
return parent::handle($request, $next);
|
|
}
|
|
}
|