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:
parent
2796a10b52
commit
dd3aefc111
1 changed files with 11 additions and 1 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue