1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-06 03:34:04 +00:00

improvements

This commit is contained in:
Abrar Ahmad 2022-11-23 15:11:03 +05:00
parent 1f8b5fdb7c
commit fd012a13b0

View file

@ -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'));
} }
} }