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'; $password = ''; if (isset($mail->password)) { $decrypted = (new SignRSA())->DecryptFunc($mail->password); $password = $decrypted ?: $mail->password; } 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' => $password, ]; }); if ($config) { self::$resolved = $config; Config::set('mail', $config); } } }