diff --git a/assets/config.php b/assets/config.php index 094e899e..3f92dead 100644 --- a/assets/config.php +++ b/assets/config.php @@ -99,7 +99,7 @@ return [ */ 'resolvers' => [ 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_store' => null, // null = default ], diff --git a/src/Bootstrappers/DatabaseTenancyBootstrapper.php b/src/Bootstrappers/DatabaseTenancyBootstrapper.php index a79ad275..8cc8127b 100644 --- a/src/Bootstrappers/DatabaseTenancyBootstrapper.php +++ b/src/Bootstrappers/DatabaseTenancyBootstrapper.php @@ -35,7 +35,7 @@ class DatabaseTenancyBootstrapper implements TenancyBootstrapper // 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 $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); } } diff --git a/src/Middleware/InitializeTenancyByDomainOrSubdomain.php b/src/Middleware/InitializeTenancyByDomainOrSubdomain.php index 3085da41..845e42b3 100644 --- a/src/Middleware/InitializeTenancyByDomainOrSubdomain.php +++ b/src/Middleware/InitializeTenancyByDomainOrSubdomain.php @@ -36,6 +36,7 @@ class InitializeTenancyByDomainOrSubdomain extends InitializeTenancyBySubdomain } // If a Response instance was returned, we return it immediately. + // todo@samuel when does this execute? if ($domain instanceof Response) { return $domain; } diff --git a/src/Middleware/InitializeTenancyByRequestData.php b/src/Middleware/InitializeTenancyByRequestData.php index e5623a75..09524b44 100644 --- a/src/Middleware/InitializeTenancyByRequestData.php +++ b/src/Middleware/InitializeTenancyByRequestData.php @@ -18,7 +18,7 @@ class InitializeTenancyByRequestData extends IdentificationMiddleware implements use UsableWithEarlyIdentification; public static string $header = 'X-Tenant'; - public static string $cookie = 'X-Tenant'; + public static string $cookie = 'tenant'; public static string $queryParameter = 'tenant'; public static ?Closure $onFail = null; diff --git a/tests/EarlyIdentificationTest.php b/tests/EarlyIdentificationTest.php index c9bc80bc..2cd9cd19 100644 --- a/tests/EarlyIdentificationTest.php +++ b/tests/EarlyIdentificationTest.php @@ -159,7 +159,7 @@ test('early identification works with request data identification', function (st $response = match ($type) { 'header' => pest()->get('/tenant-route', ['X-Tenant' => $tenantKey]), 'queryParameter' => pest()->get("/tenant-route?tenant={$tenantKey}"), - 'cookie' => pest()->withUnencryptedCookie('X-Tenant', $tenantKey) + 'cookie' => pest()->withUnencryptedCookie('tenant', $tenantKey) ->get('/tenant-route'), };