mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 14:34:04 +00:00
Replaced tenant connection name with getTemplateConnectionName
This commit is contained in:
parent
f12c826df5
commit
5bb2e4ef5a
1 changed files with 4 additions and 4 deletions
|
|
@ -38,9 +38,9 @@ class DatabaseManager
|
|||
*/
|
||||
public function connectToTenant(TenantWithDatabase $tenant)
|
||||
{
|
||||
$this->database->purge('tenant');
|
||||
$this->database->purge($tenant->database()->getTemplateConnectionName());
|
||||
$this->createTenantConnection($tenant);
|
||||
$this->setDefaultConnection('tenant');
|
||||
$this->setDefaultConnection($tenant->database()->getTemplateConnectionName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -49,7 +49,7 @@ class DatabaseManager
|
|||
public function reconnectToCentral()
|
||||
{
|
||||
if (tenancy()->initialized) {
|
||||
$this->database->purge('tenant');
|
||||
$this->database->purge($tenant->database()->getTemplateConnectionName());
|
||||
}
|
||||
|
||||
$this->setDefaultConnection($this->config->get('tenancy.database.central_connection'));
|
||||
|
|
@ -69,7 +69,7 @@ class DatabaseManager
|
|||
*/
|
||||
public function createTenantConnection(TenantWithDatabase $tenant)
|
||||
{
|
||||
$this->app['config']['database.connections.tenant'] = $tenant->database()->connection();
|
||||
$this->app['config']['database.connections.'.$tenant->database()->getTemplateConnectionName()] = $tenant->database()->connection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue