add: full multi-tenancy control
This commit is contained in:
22
app/Http/Middleware/UniversalTenancy.php
Normal file
22
app/Http/Middleware/UniversalTenancy.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user