mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 06:24:04 +00:00
Enabled header and querystring customisation
This commit is contained in:
parent
b8d2c0f4db
commit
3e5dc66d72
2 changed files with 11 additions and 4 deletions
|
|
@ -88,6 +88,10 @@ return [
|
||||||
'storage_to_config_map' => [ // Used by the TenantConfig feature
|
'storage_to_config_map' => [ // Used by the TenantConfig feature
|
||||||
// 'paypal_api_key' => 'services.paypal.api_key',
|
// 'paypal_api_key' => 'services.paypal.api_key',
|
||||||
],
|
],
|
||||||
|
'identification' => [
|
||||||
|
'header' => 'X-Tenant', // Can be anything, but should really start with "X-",
|
||||||
|
'query_parameter' => '_tenant'
|
||||||
|
],
|
||||||
'home_url' => '/app',
|
'home_url' => '/app',
|
||||||
'queue_database_creation' => false,
|
'queue_database_creation' => false,
|
||||||
'migrate_after_creation' => false, // run migrations after creating a tenant
|
'migrate_after_creation' => false, // run migrations after creating a tenant
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,14 @@ class InitializeTenancyByRequestData
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$header = config('tenancy.identification.header');
|
||||||
|
$query = config('tenancy.identification.query_parameter');
|
||||||
|
|
||||||
$tenant = null;
|
$tenant = null;
|
||||||
if ($request->hasHeader('X-Tenant')) {
|
if ($request->hasHeader($header)) {
|
||||||
$tenant = $request->header('X-Tenant');
|
$tenant = $request->header($header);
|
||||||
} elseif ($request->has('_tenant')) {
|
} elseif ($request->has($query)) {
|
||||||
$tenant = $request->get('_tenant');
|
$tenant = $request->get($query);
|
||||||
} elseif (! in_array($request->getHost(), config('tenancy.exempt_domains', []), true)) {
|
} elseif (! in_array($request->getHost(), config('tenancy.exempt_domains', []), true)) {
|
||||||
$tenant = explode('.', $request->getHost())[0];
|
$tenant = explode('.', $request->getHost())[0];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue