update setting env smtp

This commit is contained in:
baodev0
2026-10-22 11:51:41 +07:00
parent 4f3442190e
commit 0fef417dcb
7 changed files with 15 additions and 3 deletions
+3 -3
View File
@@ -90,12 +90,12 @@ final class MailSettings
$mail = Setting::where('key', 'smtp')->first();
$setting = Setting::where('key', 'setting')->first();
if (!$mail || !$setting) {
$mail = $mail ? json_decode((string) $mail->value) : null;
if (!is_object($mail)) {
return null;
}
$mail = json_decode($mail->value);
$company = json_decode($setting->value)->company ?? 'Your Company';
$company = ($setting ? json_decode((string) $setting->value)->company ?? null : null) ?: config('mail.from.name');
$password = '';
if (isset($mail->password)) {
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -49,6 +49,18 @@ class MailSettingsQueueTest extends TestCase
$this->assertSame('smtp.settings-two.test', $this->hostSeenByQueuedJob());
}
public function test_smtp_settings_apply_without_general_setting_row(): void
{
$this->saveSmtp('smtp.settings-only.test');
Setting::where('key', 'setting')->delete();
Cache::forget(MailSettings::cacheKey());
MailSettings::apply();
$this->assertSame('smtp.settings-only.test', config('mail.mailers.smtp.host'));
$this->assertSame('TGS', config('mail.from.name'));
}
public function test_system_cc_and_bcc_are_applied_without_duplicate_recipients(): void
{
$this->saveSmtp('smtp.settings.test');