mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 05:44:02 +00:00
improvements
This commit is contained in:
parent
1f8b5fdb7c
commit
fd012a13b0
1 changed files with 1 additions and 4 deletions
|
|
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Stancl\Tenancy\Listeners;
|
namespace Stancl\Tenancy\Listeners;
|
||||||
|
|
||||||
use Illuminate\Foundation\Application;
|
|
||||||
use Stancl\Tenancy\Database\DatabaseManager;
|
use Stancl\Tenancy\Database\DatabaseManager;
|
||||||
use Stancl\Tenancy\Events\Contracts\TenancyEvent;
|
use Stancl\Tenancy\Events\Contracts\TenancyEvent;
|
||||||
|
|
||||||
|
|
@ -12,13 +11,11 @@ class UseCentralConnection
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected DatabaseManager $database,
|
protected DatabaseManager $database,
|
||||||
protected Application $app
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(TenancyEvent $event): void
|
public function handle(TenancyEvent $event): void
|
||||||
{
|
{
|
||||||
$this->database->purgeTenantConnection();
|
$this->database->reconnectToCentral();
|
||||||
$this->database->setDefaultConnection($this->app['config']->get('tenancy.database.central_connection'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue