mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:04:02 +00:00
Fix notADomain logic
This commit is contained in:
parent
43d36205b8
commit
41127048f1
1 changed files with 4 additions and 1 deletions
|
|
@ -54,8 +54,11 @@ class InitializeTenancyBySubdomain extends InitializeTenancyByDomain
|
||||||
{
|
{
|
||||||
$parts = explode('.', $hostname);
|
$parts = explode('.', $hostname);
|
||||||
|
|
||||||
|
$isLocalhost = count($parts) === 1;
|
||||||
|
$isIpAddress = count(array_filter($parts, 'is_numeric')) === count($parts);
|
||||||
|
|
||||||
// If we're on localhost or an IP address, then we're not visiting a subdomain.
|
// If we're on localhost or an IP address, then we're not visiting a subdomain.
|
||||||
$notADomain = in_array(count($parts), [1, 4]);
|
$notADomain = $isLocalhost || $isIpAddress;
|
||||||
$thirdPartyDomain = ! Str::endsWith($hostname, config('tenancy.central_domains'));
|
$thirdPartyDomain = ! Str::endsWith($hostname, config('tenancy.central_domains'));
|
||||||
|
|
||||||
if ($notADomain || $thirdPartyDomain) {
|
if ($notADomain || $thirdPartyDomain) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue