data = $data; $this->email_subject = $email_subject; $this->from_email = $from; $this->attachment = $attachment; $this->template = $template; } /** * Build the message. * * @return $this */ public function build() { $mail = $this->subject($this->email_subject) ->from($this->from_email) ->markdown($this->template) ->with(['data' => $this->data]); if(!empty($this->attachment)){ $mail = $mail->attach($this->attachment); //unlink($this->attachment); } return $mail; //return $this->view($this->template); } }