1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 20:34:03 +00:00

todo and comments

This commit is contained in:
Abrar Ahmad 2022-09-23 11:39:21 +05:00
parent 4f71f0bab3
commit 2a6290be9c
2 changed files with 4 additions and 1 deletions

View file

@ -205,7 +205,9 @@ class DatabaseConfig
/** Get the TenantDatabaseManager for this tenant's connection. */
public function hostManager(): Contracts\TenantDatabaseManager
{
$this->purgeHostConnection();
// DB cache the previous connection configurations and changing the connection configuration does not work
// So we purge the previous host connection before changing it
$this->purgeHostConnection(); // todo come up with a better name
$tenantHostConnectionName = $this->getTenantHostConnectionName();
config(["database.connections.{$tenantHostConnectionName}" => $this->hostConnection()]);

View file

@ -100,6 +100,7 @@ test('the tenant connection is fully removed', function () {
$tenant = Tenant::create();
dd(array_keys(app('db')->getConnections()));
expect(array_keys(app('db')->getConnections()))->not()->toContain('tenant');
pest()->assertArrayNotHasKey('tenant', config('database.connections'));