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

Simplify bootstrap method

This commit is contained in:
lukinovec 2022-11-01 18:17:52 +01:00
parent d895a30c30
commit 04ada13584

View file

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Bootstrappers;
use Illuminate\Config\Repository;
use Illuminate\Support\Arr;
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
use Stancl\Tenancy\Contracts\Tenant;
@ -38,12 +37,11 @@ class MailTenancyBootstrapper implements TenancyBootstrapper
public function bootstrap(Tenant $tenant): void
{
foreach (static::$credentialsMap as $storageKey => $configKey) {
/** @var Tenant&Model $tenant */
$override = Arr::get($tenant, $storageKey);
foreach (static::$credentialsMap as $configKey => $storageKey) {
$override = $tenant->$storageKey;
if (! is_null($override)) {
$this->originalConfig[$configKey] = $this->originalConfig[$configKey] ?? $this->config->get($configKey);
$this->originalConfig[$configKey] ??= $this->config->get($configKey);
$this->config->set($configKey, $override);
}