mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 02:04:03 +00:00
24 lines
489 B
PHP
24 lines
489 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
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);
|
|
}
|
|
}
|