mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 15:54:03 +00:00
change default cookie name, add todos
This commit is contained in:
parent
55b1c5387c
commit
83b1ae1aea
5 changed files with 5 additions and 4 deletions
|
|
@ -99,7 +99,7 @@ return [
|
||||||
*/
|
*/
|
||||||
'resolvers' => [
|
'resolvers' => [
|
||||||
Resolvers\DomainTenantResolver::class => [
|
Resolvers\DomainTenantResolver::class => [
|
||||||
'cache' => false,
|
'cache' => false, // todo@tests find why some tests fail when these are set to true
|
||||||
'cache_ttl' => 3600, // seconds
|
'cache_ttl' => 3600, // seconds
|
||||||
'cache_store' => null, // null = default
|
'cache_store' => null, // null = default
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class DatabaseTenancyBootstrapper implements TenancyBootstrapper
|
||||||
// Better debugging, but breaks cached lookup in prod
|
// Better debugging, but breaks cached lookup in prod
|
||||||
if (app()->environment('local') || app()->environment('testing')) { // todo@docs mention this change in v4 upgrade guide https://github.com/archtechx/tenancy/pull/945#issuecomment-1268206149
|
if (app()->environment('local') || app()->environment('testing')) { // todo@docs mention this change in v4 upgrade guide https://github.com/archtechx/tenancy/pull/945#issuecomment-1268206149
|
||||||
$database = $tenant->database()->getName();
|
$database = $tenant->database()->getName();
|
||||||
if (! $tenant->database()->manager()->databaseExists($database)) {
|
if (! $tenant->database()->manager()->databaseExists($database)) { // todo@samuel does this call correctly use the host connection?
|
||||||
throw new TenantDatabaseDoesNotExistException($database);
|
throw new TenantDatabaseDoesNotExistException($database);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ class InitializeTenancyByDomainOrSubdomain extends InitializeTenancyBySubdomain
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a Response instance was returned, we return it immediately.
|
// If a Response instance was returned, we return it immediately.
|
||||||
|
// todo@samuel when does this execute?
|
||||||
if ($domain instanceof Response) {
|
if ($domain instanceof Response) {
|
||||||
return $domain;
|
return $domain;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class InitializeTenancyByRequestData extends IdentificationMiddleware implements
|
||||||
use UsableWithEarlyIdentification;
|
use UsableWithEarlyIdentification;
|
||||||
|
|
||||||
public static string $header = 'X-Tenant';
|
public static string $header = 'X-Tenant';
|
||||||
public static string $cookie = 'X-Tenant';
|
public static string $cookie = 'tenant';
|
||||||
public static string $queryParameter = 'tenant';
|
public static string $queryParameter = 'tenant';
|
||||||
public static ?Closure $onFail = null;
|
public static ?Closure $onFail = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ test('early identification works with request data identification', function (st
|
||||||
$response = match ($type) {
|
$response = match ($type) {
|
||||||
'header' => pest()->get('/tenant-route', ['X-Tenant' => $tenantKey]),
|
'header' => pest()->get('/tenant-route', ['X-Tenant' => $tenantKey]),
|
||||||
'queryParameter' => pest()->get("/tenant-route?tenant={$tenantKey}"),
|
'queryParameter' => pest()->get("/tenant-route?tenant={$tenantKey}"),
|
||||||
'cookie' => pest()->withUnencryptedCookie('X-Tenant', $tenantKey)
|
'cookie' => pest()->withUnencryptedCookie('tenant', $tenantKey)
|
||||||
->get('/tenant-route'),
|
->get('/tenant-route'),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue