1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 08:44:04 +00:00

Fix static property

This commit is contained in:
Samuel Štancl 2020-04-30 21:33:31 +02:00
parent 2de46e4274
commit 16f85558ec
2 changed files with 6 additions and 6 deletions

View file

@ -54,7 +54,7 @@ class DatabaseManager
*/
public function connect(Tenant $tenant)
{
$this->createTenantConnection($tenant, $tenant->database()->getTemplateConnectionName());
$this->createTenantConnection($tenant);
$this->setDefaultConnection($tenant->database()->getTemplateConnectionName());
$this->switchConnection($tenant->database()->getTemplateConnectionName());
}
@ -66,8 +66,8 @@ class DatabaseManager
{
// Opposite order to connect() because we don't
// want to ever purge the central connection
$this->switchConnection($this->originalDefaultConnectionName);
$this->setDefaultConnection($this->originalDefaultConnectionName);
$this->switchConnection(static::$originalDefaultConnectionName);
$this->setDefaultConnection(static::$originalDefaultConnectionName);
}
/**
@ -81,9 +81,9 @@ class DatabaseManager
/**
* 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();
}
/**

View file

@ -59,7 +59,7 @@ class DatabaseStorageDriver implements StorageDriver, CanDeleteKeys, CanFindByAn
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