1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 12:24:04 +00:00

Create listener for manual mode multi-db

This commit is contained in:
Samuel Štancl 2020-06-02 18:57:18 +02:00
parent b2c240a9f0
commit d8563ba7e9

View file

@ -0,0 +1,22 @@
<?php
namespace Stancl\Tenancy\Listeners;
use Stancl\Tenancy\Database\DatabaseManager;
use Stancl\Tenancy\Events\Contracts\TenantEvent;
class CreateTenantConnection
{
/** @var DatabaseManager */
protected $database;
public function __construct(DatabaseManager $database)
{
$this->database = $database;
}
public function handle(TenantEvent $event)
{
$this->database->createTenantConnection($event->tenant);
}
}