mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 19:54:04 +00:00
Extract setDefaultConnection()
This commit is contained in:
parent
93283d39ed
commit
c01c40e715
1 changed files with 11 additions and 1 deletions
|
|
@ -56,6 +56,17 @@ class DatabaseManager
|
|||
$this->setDefaultConnection($this->originalDefaultConnectionName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the default database connection config.
|
||||
*
|
||||
* @param string $connection
|
||||
* @return void
|
||||
*/
|
||||
public function setDefaultConnection(string $connection)
|
||||
{
|
||||
$this->app['config']['database.default'] = $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the tenant database connection.
|
||||
*
|
||||
|
|
@ -106,7 +117,6 @@ class DatabaseManager
|
|||
*/
|
||||
public function switchConnection(string $connection)
|
||||
{
|
||||
$this->app['config']['database.default'] = $connection;
|
||||
$this->database->purge();
|
||||
$this->database->reconnect($connection);
|
||||
$this->database->setDefaultConnection($connection);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue