mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:44:02 +00:00
34 lines
710 B
PHP
34 lines
710 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Stancl\Tenancy\TenancyBoostrappers;
|
|
|
|
use Illuminate\Foundation\Application;
|
|
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
|
use Stancl\Tenancy\DatabaseManager;
|
|
|
|
class DatabaseTenancyBootstrapper implements TenancyBootstrapper
|
|
{
|
|
/** @var Application */
|
|
protected $app;
|
|
|
|
/** @var DatabaseManager */
|
|
protected $database;
|
|
|
|
public function __construct(Application $app, DatabaseManager $database)
|
|
{
|
|
$this->app = $app;
|
|
$this->database = $database;
|
|
}
|
|
|
|
public function start(Tenant $tenant)
|
|
{
|
|
$this->database->connect($tenant);
|
|
}
|
|
|
|
public function end()
|
|
{
|
|
$this->database->reconnect();
|
|
}
|
|
}
|