mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 06:24:04 +00:00
Fix static property
This commit is contained in:
parent
2de46e4274
commit
16f85558ec
2 changed files with 6 additions and 6 deletions
|
|
@ -54,7 +54,7 @@ class DatabaseManager
|
||||||
*/
|
*/
|
||||||
public function connect(Tenant $tenant)
|
public function connect(Tenant $tenant)
|
||||||
{
|
{
|
||||||
$this->createTenantConnection($tenant, $tenant->database()->getTemplateConnectionName());
|
$this->createTenantConnection($tenant);
|
||||||
$this->setDefaultConnection($tenant->database()->getTemplateConnectionName());
|
$this->setDefaultConnection($tenant->database()->getTemplateConnectionName());
|
||||||
$this->switchConnection($tenant->database()->getTemplateConnectionName());
|
$this->switchConnection($tenant->database()->getTemplateConnectionName());
|
||||||
}
|
}
|
||||||
|
|
@ -66,8 +66,8 @@ class DatabaseManager
|
||||||
{
|
{
|
||||||
// Opposite order to connect() because we don't
|
// Opposite order to connect() because we don't
|
||||||
// want to ever purge the central connection
|
// want to ever purge the central connection
|
||||||
$this->switchConnection($this->originalDefaultConnectionName);
|
$this->switchConnection(static::$originalDefaultConnectionName);
|
||||||
$this->setDefaultConnection($this->originalDefaultConnectionName);
|
$this->setDefaultConnection(static::$originalDefaultConnectionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -81,9 +81,9 @@ class DatabaseManager
|
||||||
/**
|
/**
|
||||||
* Create the tenant database connection.
|
* Create the tenant database connection.
|
||||||
*/
|
*/
|
||||||
public function createTenantConnection(Tenant $tenant, $connectionName)
|
public function createTenantConnection(Tenant $tenant)
|
||||||
{
|
{
|
||||||
$this->app['config']["database.connections.$connectionName"] = $tenant->database()->connection();
|
$this->app['config']["database.connections.{$tenant->database()->getTemplateConnectionName()}"] = $tenant->database()->connection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class DatabaseStorageDriver implements StorageDriver, CanDeleteKeys, CanFindByAn
|
||||||
|
|
||||||
public static function getCentralConnectionName(): string
|
public static function getCentralConnectionName(): string
|
||||||
{
|
{
|
||||||
return config('tenancy.storage_drivers.db.connection') ?? app(DatabaseManager::class)->originalDefaultConnectionName;
|
return config('tenancy.storage_drivers.db.connection') ?? DatabaseManager::$originalDefaultConnectionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findByDomain(string $domain): Tenant
|
public function findByDomain(string $domain): Tenant
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue