1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-04 09:04:03 +00:00

fix incorrect subdomain identification

This commit is contained in:
kostamilorava 2025-12-11 19:20:16 +04:00
parent 45cf7029af
commit 59d2c6d98d

View file

@ -56,9 +56,19 @@ class DomainTenantResolver extends Contracts\CachedTenantResolver
return $tenant; return $tenant;
} }
public static function isSubdomain(string $domain): bool protected function isSubdomain(string $hostname): bool
{ {
return Str::endsWith($domain, config('tenancy.identification.central_domains')); foreach (config('tenancy.central_domains') as $domain) {
if ($hostname === $domain) {
return false;
}
if (Str::endsWith($hostname, '.' . $domain)) {
return true;
}
}
return false;
} }
public function resolved(Tenant $tenant, mixed ...$args): void public function resolved(Tenant $tenant, mixed ...$args): void