1 | <?php |
||
2 | |||
3 | namespace Chuckbe\Chuckcms\Mail; |
||
4 | |||
5 | use Illuminate\Bus\Queueable; |
||
6 | use Illuminate\Mail\Mailable; |
||
7 | use Illuminate\Queue\SerializesModels; |
||
8 | |||
9 | class FormActionMail extends Mailable |
||
10 | { |
||
11 | use Queueable; |
||
12 | use SerializesModels; |
||
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
13 | |||
14 | public $mailData; |
||
15 | |||
16 | /** |
||
17 | * Create a new message instance. |
||
18 | * |
||
19 | * @return void |
||
20 | */ |
||
21 | public function __construct($mailData) |
||
22 | { |
||
23 | $this->mailData = $mailData; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Build the message. |
||
28 | * |
||
29 | * @return $this |
||
30 | */ |
||
31 | public function build() |
||
32 | { |
||
33 | $mail = $this->from($this->mailData['from'], $this->mailData['from_name']) |
||
34 | ->to($this->mailData['to'], $this->mailData['to_name']) |
||
35 | ->subject($this->mailData['subject']) |
||
36 | ->view($this->mailData['template']); |
||
37 | if (is_array($this->mailData['files'])) { |
||
38 | foreach ($this->mailData['files'] as $file) { |
||
39 | if ($file !== null) { |
||
40 | $mail->attach(public_path($file)); |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | |||
45 | return $mail; |
||
46 | } |
||
47 | } |
||
48 |