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

Enabled header and querystring customisation

This commit is contained in:
Jesper Jacobsen 2019-11-16 22:32:38 +01:00
parent b8d2c0f4db
commit 3e5dc66d72
2 changed files with 11 additions and 4 deletions

View file

@ -46,11 +46,14 @@ class InitializeTenancyByRequestData
return;
}
$header = config('tenancy.identification.header');
$query = config('tenancy.identification.query_parameter');
$tenant = null;
if ($request->hasHeader('X-Tenant')) {
$tenant = $request->header('X-Tenant');
} elseif ($request->has('_tenant')) {
$tenant = $request->get('_tenant');
if ($request->hasHeader($header)) {
$tenant = $request->header($header);
} elseif ($request->has($query)) {
$tenant = $request->get($query);
} elseif (! in_array($request->getHost(), config('tenancy.exempt_domains', []), true)) {
$tenant = explode('.', $request->getHost())[0];
}