mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 03:34:04 +00:00
purge connection improvements
This commit is contained in:
parent
677b62cf05
commit
45db7e6592
1 changed files with 5 additions and 4 deletions
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Stancl\Tenancy\Database;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Database;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
|
@ -149,12 +150,12 @@ class DatabaseConfig
|
|||
*/
|
||||
public function purgeHostConnection(): void
|
||||
{
|
||||
$databaseManager = app(Database\DatabaseManager::class);
|
||||
$tenantHostConnectionName = $this->getTenantHostConnectionName();
|
||||
$databaseManager->purge($tenantHostConnectionName);
|
||||
// if (array_key_exists($tenantHostConnectionName, $databaseManager->getConnections())) {
|
||||
|
||||
if (config("database.connections.{$tenantHostConnectionName}")) {
|
||||
DB::purge($tenantHostConnectionName);
|
||||
config(["database.connections.{$tenantHostConnectionName}" => null]);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue