| Conditions | 3 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | public function __invoke(EmailSettingsRequest $request) |
||
| 19 | { |
||
| 20 | // Modify the settings so that they are entered into the database properly |
||
| 21 | $mailSettings = [ |
||
| 22 | 'mail.from.address' => $request->from_address, |
||
| 23 | 'mail.mailers.smtp.username' => $request->authentication ? $request->username : null, |
||
| 24 | 'mail.mailers.smtp.host' => $request->host, |
||
| 25 | 'mail.mailers.smtp.port' => $request->port, |
||
| 26 | 'mail.mailers.smtp.encryption' => $request->encryption |
||
| 27 | ]; |
||
| 28 | |||
| 29 | // Only update the password if it has been modified |
||
| 30 | if($request->password !== 'RandomString') |
||
| 31 | { |
||
| 32 | $mailSettings['mail.mailers.smtp.password'] = $request->password; |
||
| 33 | } |
||
| 34 | |||
| 35 | // Submit the settings |
||
| 36 | $this->saveArray($mailSettings); |
||
| 37 | |||
| 38 | event(new EmailSettingsUpdatedEvent($request)); |
||
| 39 | return back()->with([ |
||
| 40 | 'message' => 'Email Settings Updated', |
||
| 41 | 'type' => 'success', |
||
| 42 | ]); |
||
| 45 |