first(); $setting = Setting::where('key', 'setting')->first(); if (!$mail || !$setting) { return null; } $mail = json_decode($mail->value); $company = json_decode($setting->value)->company ?? 'Your Company'; return [ 'driver' => $mail->transport ?? 'smtp', 'host' => $mail->host ?? '', 'port' => $mail->port ?? 587, 'from' => [ 'address' => $mail->user ?? 'no-reply@example.com', 'name' => $company, ], 'encryption' => $mail->encryption === 0 ? 'tls' : $mail->encryption, 'username' => $mail->user ?? '', 'password' => isset($mail->password) ? SignRSA::DecryptFunc($mail->password) : '', ]; }); if ($config) { Config::set('mail', $config); } } }