mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 20:34:03 +00:00
Simplify bootstrap method
This commit is contained in:
parent
d895a30c30
commit
04ada13584
1 changed files with 3 additions and 5 deletions
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||||
namespace Stancl\Tenancy\Bootstrappers;
|
namespace Stancl\Tenancy\Bootstrappers;
|
||||||
|
|
||||||
use Illuminate\Config\Repository;
|
use Illuminate\Config\Repository;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
||||||
use Stancl\Tenancy\Contracts\Tenant;
|
use Stancl\Tenancy\Contracts\Tenant;
|
||||||
|
|
||||||
|
|
@ -38,12 +37,11 @@ class MailTenancyBootstrapper implements TenancyBootstrapper
|
||||||
|
|
||||||
public function bootstrap(Tenant $tenant): void
|
public function bootstrap(Tenant $tenant): void
|
||||||
{
|
{
|
||||||
foreach (static::$credentialsMap as $storageKey => $configKey) {
|
foreach (static::$credentialsMap as $configKey => $storageKey) {
|
||||||
/** @var Tenant&Model $tenant */
|
$override = $tenant->$storageKey;
|
||||||
$override = Arr::get($tenant, $storageKey);
|
|
||||||
|
|
||||||
if (! is_null($override)) {
|
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);
|
$this->config->set($configKey, $override);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue