mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 16:34:04 +00:00
Use static property for map presets
This commit is contained in:
parent
55aa49b18e
commit
a0ad69a95c
1 changed files with 5 additions and 14 deletions
|
|
@ -24,28 +24,19 @@ class MailTenancyBootstrapper implements TenancyBootstrapper
|
||||||
|
|
||||||
protected array $originalConfig = [];
|
protected array $originalConfig = [];
|
||||||
|
|
||||||
public static function smtpPreset(): array
|
public static array $mapPresets = [
|
||||||
{
|
'smtp' => [
|
||||||
return [
|
|
||||||
'mail.mailers.smtp.host' => 'smtp_host',
|
'mail.mailers.smtp.host' => 'smtp_host',
|
||||||
'mail.mailers.smtp.port' => 'smtp_port',
|
'mail.mailers.smtp.port' => 'smtp_port',
|
||||||
'mail.mailers.smtp.username' => 'smtp_username',
|
'mail.mailers.smtp.username' => 'smtp_username',
|
||||||
'mail.mailers.smtp.password' => 'smtp_password',
|
'mail.mailers.smtp.password' => 'smtp_password',
|
||||||
];
|
],
|
||||||
}
|
];
|
||||||
|
|
||||||
public function __construct(protected Repository $config)
|
public function __construct(protected Repository $config)
|
||||||
{
|
{
|
||||||
static::$mailer ??= $config->get('mail.default');
|
static::$mailer ??= $config->get('mail.default');
|
||||||
static::$credentialsMap = array_merge(static::$credentialsMap, $this->pickMapPreset() ?? []);
|
static::$credentialsMap = array_merge(static::$credentialsMap, static::$mapPresets[static::$mailer] ?? []);
|
||||||
}
|
|
||||||
|
|
||||||
protected function pickMapPreset(): array|null
|
|
||||||
{
|
|
||||||
return match (static::$mailer) {
|
|
||||||
'smtp' => static::smtpPreset(),
|
|
||||||
default => null,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bootstrap(Tenant $tenant): void
|
public function bootstrap(Tenant $tenant): void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue