| Total Complexity | 4 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class OneToAll implements Mode |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @param SheduleEmail $tasks |
||
| 19 | */ |
||
| 20 | public function postEmail(SheduleEmail $tasks) : void |
||
| 21 | { |
||
| 22 | 2 | Mail::send('postman::email', ['html' => $tasks->email->text], function($message) use ($tasks) { |
|
| 23 | 2 | $message->subject($tasks->email->theme); |
|
| 24 | 2 | $message->from(config('mail.from.address')); |
|
| 25 | 2 | $message->to(config('mail.from.address')); |
|
| 26 | 2 | $tasks->email->users->each(function ($value) use ($message) { |
|
| 27 | 1 | $message->bcc($value->email); |
|
| 28 | 2 | }); |
|
| 29 | 2 | }); |
|
| 30 | |||
| 31 | // if to reached the sender |
||
| 32 | 2 | if (empty(Mail::failures())) { |
|
| 33 | 1 | $tasks->status_id = Status::done(); |
|
| 34 | 1 | $tasks->save(); |
|
| 35 | } |
||
| 36 | 2 | } |
|
| 37 | |||
| 38 | /** |
||
| 39 | * Get name mode |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | 6 | public function getName(): string |
|
| 43 | { |
||
| 44 | 6 | return trans('postman::mode.one.name'); |
|
|
|
|||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Get full description |
||
| 49 | * @return string |
||
| 50 | */ |
||
| 51 | 6 | public function getDescription(): string |
|
| 54 | } |
||
| 55 | } |