jeremykenedy /
larablog
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Mail; |
||
| 4 | |||
| 5 | use Illuminate\Bus\Queueable; |
||
| 6 | use Illuminate\Mail\Mailable; |
||
| 7 | use Illuminate\Queue\SerializesModels; |
||
| 8 | |||
| 9 | class ContactMail extends Mailable |
||
| 10 | { |
||
| 11 | use Queueable; |
||
| 12 | use SerializesModels; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 13 | |||
| 14 | public $firstname; |
||
| 15 | public $lastname; |
||
| 16 | public $phone; |
||
| 17 | public $email; |
||
| 18 | public $messageLines; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Create a new message instance. |
||
| 22 | * |
||
| 23 | * @return void |
||
| 24 | */ |
||
| 25 | public function __construct($validatedData) |
||
| 26 | { |
||
| 27 | $this->firstname = array_key_exists('firstname', $validatedData) ? $validatedData['firstname'] : null; |
||
| 28 | $this->lastname = array_key_exists('lastname', $validatedData) ? $validatedData['lastname'] : null; |
||
| 29 | $this->phone = array_key_exists('phone', $validatedData) ? $validatedData['phone'] : null; |
||
| 30 | $this->email = array_key_exists('email', $validatedData) ? $validatedData['email'] : null; |
||
| 31 | $this->messageLines = array_key_exists('message', $validatedData) ? explode("\n", $validatedData['message']) : null; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Build the message. |
||
| 36 | * |
||
| 37 | * @return $this |
||
| 38 | */ |
||
| 39 | public function build() |
||
| 40 | { |
||
| 41 | return $this->view('mail.contact'); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |