Merge subdomain fix

This commit is contained in:
Hillel Coren 2018-01-15 22:48:53 +02:00
parent 2417005b23
commit c30547a331
2 changed files with 11 additions and 2 deletions

View File

@ -58,6 +58,11 @@ class DatabaseLookup
} elseif ($guard == 'account') {
if ($key = request()->account_key) {
LookupAccount::setServerByField('account_key', $key);
} else {
$subdomain = Utils::getSubdomain(\Request::server('HTTP_HOST'));
if ($subdomain != 'app') {
LookupAccount::setServerByField('subdomain', $subdomain);
}
}
} elseif ($guard == 'license') {
config(['database.default' => DB_NINJA_1]);

View File

@ -1002,8 +1002,12 @@ class Utils
$parts = parse_url($url);
$subdomain = '';
if (isset($parts['host']) || isset($parts['path'])) {
if (isset($parts['host'])) {
$host = explode('.', $parts['host']);
} else {
$host = explode('.', $parts['path']);
}
if (count($host) > 2) {
$subdomain = $host[0];
}