1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 14:54:03 +00:00

Split config logic into methods

This commit is contained in:
lukinovec 2022-11-02 13:49:24 +01:00
parent 2796a10b52
commit dd3aefc111

View file

@ -36,6 +36,16 @@ class MailTenancyBootstrapper implements TenancyBootstrapper
} }
public function bootstrap(Tenant $tenant): void public function bootstrap(Tenant $tenant): void
{
$this->setConfig($tenant);
}
public function revert(): void
{
$this->unsetConfig();
}
protected function setConfig(Tenant $tenant)
{ {
foreach (static::$credentialsMap as $configKey => $storageKey) { foreach (static::$credentialsMap as $configKey => $storageKey) {
$override = $tenant->$storageKey; $override = $tenant->$storageKey;
@ -48,7 +58,7 @@ class MailTenancyBootstrapper implements TenancyBootstrapper
} }
} }
public function revert(): void protected function unsetConfig()
{ {
foreach ($this->originalConfig as $key => $value) { foreach ($this->originalConfig as $key => $value) {
$this->config->set($key, $value); $this->config->set($key, $value);