mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 21:54:03 +00:00
DB manager now doesn't depend on DB storage driver
This commit is contained in:
parent
c965ca5c93
commit
ae6cf5c1ab
3 changed files with 18 additions and 21 deletions
|
|
@ -4,10 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy;
|
||||
|
||||
use Illuminate\Database\Connection;
|
||||
use Illuminate\Database\DatabaseManager as BaseDatabaseManager;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Stancl\Tenancy\Contracts\TenantDatabaseManager;
|
||||
use Stancl\Tenancy\Exceptions\DatabaseManagerNotRegisteredException;
|
||||
use Stancl\Tenancy\Exceptions\TenantDatabaseAlreadyExistsException;
|
||||
|
|
@ -178,20 +176,4 @@ class DatabaseManager
|
|||
|
||||
return $this->app[$databaseManagers[$driver]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the central database connection.
|
||||
*
|
||||
* @return \Illuminate\Database\Connection
|
||||
*/
|
||||
public function getCentralConnection(): \Illuminate\Database\Connection
|
||||
{
|
||||
return DB::connection($this->getCentralConnectionName());
|
||||
}
|
||||
|
||||
// todo this should not depend on the storage driver
|
||||
public function getCentralConnectionName(): string
|
||||
{
|
||||
return $this->app['config']['tenancy.storage_drivers.db.connection'] ?? $this->originalDefaultConnectionName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue