first(); $setting = Setting::where('key', 'setting')->first(); if ($mail) { $mail = (object)json_decode($mail->value); $config = array( 'driver' => $mail->transport, 'host' => $mail->host, 'port' => $mail->port, 'from' => array('address' => $mail->user, 'name' => json_decode($setting->value)->company), 'encryption' => $mail->encryption === 0 ? 'tls' : $mail->encryption, 'username' => $mail->user, 'password' => $mail->password ? SignRSA::DecryptFunc($mail->password) : "" ); Config::set('mail', $config); } } }