originalCentralConnectionConfig = $config->get('database.connections.central'); $this->originalPostgresConfig = $config->get('database.connections.pgsql'); } public function bootstrap(Tenant $tenant): void { /** @var TenantWithDatabase $tenant */ $this->database->purge('central'); $this->config->set('database.connections.pgsql.username', $tenant->database()->getUsername() ?? $tenant->getTenantKey()); $this->config->set('database.connections.pgsql.password', $tenant->database()->getPassword() ?? 'password'); $this->config->set('database.connections.central', $this->config->get('database.connections.pgsql')); } public function revert(): void { $this->database->purge('central'); $this->config->set('database.connections.central', $this->originalCentralConnectionConfig); $this->config->set('database.connections.pgsql', $this->originalPostgresConfig); } }