| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 1 | public function postEmail(SheduleEmail $tasks) |
|
| 17 | { |
||
| 18 | 1 | $template = config('postman.templates.'.get_class($this)); |
|
| 19 | 1 | Mail::send($template['name_template'], [$template['variable'] => $tasks->email->text], function($message) use ($tasks) { |
|
| 20 | 1 | $message->subject($tasks->email->theme); |
|
| 21 | 1 | $message->from(config('mail.from.address')); |
|
| 22 | $message->to($tasks->email->users->map(function($value){ return $value->email;})->toArray()); |
||
| 23 | 1 | }); |
|
| 24 | |||
| 25 | // if to reached the sender |
||
| 26 | 1 | if (empty(Mail::failures())) { |
|
| 27 | 1 | $tasks->status_id = Status::done(); |
|
| 28 | 1 | $tasks->save(); |
|
| 29 | } |
||
| 49 | } |