Skip to content

Commit dbbf079

Browse files
authored
Merge pull request #19 from FBNKCMaster/develop
Fix: Bug fix for unknown getDomain method & getRootDomain's args
2 parents e49f6b2 + fa12c5a commit dbbf079

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/Middleware/SelectTenant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function handle($request, Closure $next)
5656
'xtenant.database.default' => $defaultDatabase,
5757
'xtenant.database.current' => $database,
5858

59-
'xtenant.domain' => XTenantSetting::getDomain(),
59+
'xtenant.domain' => XTenantSetting::getRootDomain(),
6060
'xtenant.super_admin_subdomain' => $xTenantSettings->super_admin_subdomain,
6161
'xtenant.subdomain' => $subdomain,
6262
'xtenant.allow_www' => $xTenantSettings->allow_www,

src/Models/XTenantSetting.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function isRootDomain(Request $request)
4242
$host = str_replace('www.', '', $host);
4343
}
4444

45-
$rootDomain = self::getRootDomain($host);
45+
$rootDomain = self::getRootDomain();
4646

4747
return $host == $rootDomain;
4848
}
@@ -59,9 +59,9 @@ public static function getSettings()
5959
return self::first();
6060
}
6161

62-
public static function getRootDomain($host)
62+
public static function getRootDomain()
6363
{
64-
$parts = explode('.', $host);
64+
$parts = explode('.', request()->getHost());
6565

6666
return implode('.', array_slice($parts, -2, 2));
6767
}

0 commit comments

Comments
 (0)