mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 17:24:03 +00:00
todo and comments
This commit is contained in:
parent
4f71f0bab3
commit
2a6290be9c
2 changed files with 4 additions and 1 deletions
|
|
@ -205,7 +205,9 @@ class DatabaseConfig
|
||||||
/** Get the TenantDatabaseManager for this tenant's connection. */
|
/** Get the TenantDatabaseManager for this tenant's connection. */
|
||||||
public function hostManager(): Contracts\TenantDatabaseManager
|
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();
|
$tenantHostConnectionName = $this->getTenantHostConnectionName();
|
||||||
config(["database.connections.{$tenantHostConnectionName}" => $this->hostConnection()]);
|
config(["database.connections.{$tenantHostConnectionName}" => $this->hostConnection()]);
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ test('the tenant connection is fully removed', function () {
|
||||||
|
|
||||||
$tenant = Tenant::create();
|
$tenant = Tenant::create();
|
||||||
|
|
||||||
|
dd(array_keys(app('db')->getConnections()));
|
||||||
expect(array_keys(app('db')->getConnections()))->not()->toContain('tenant');
|
expect(array_keys(app('db')->getConnections()))->not()->toContain('tenant');
|
||||||
pest()->assertArrayNotHasKey('tenant', config('database.connections'));
|
pest()->assertArrayNotHasKey('tenant', config('database.connections'));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue