data = $data; } /** * Build the message. * * @return $this */ public function build() { $data = $this->data; $this->joinFileIfProvided(); return $this->subject("Contact - " . config('theme.site_name', 'Boutique') . " - " . $data->subject) ->from($data->email) ->view('mails.send-contact', compact('data')); } /** * Attach a joined file if given in data * * @return void */ protected function joinFileIfProvided(): void { if ($this->data->file) { $this->joinedFileName = sprintf( 'BOUTIQUE_MESSAGE-PJ-%s.%s', date("YmdHis"), $this->data->file->extension() ); $this->attach($this->data->file, [ 'as' => $this->joinedFileName, 'mime' => $this->data->file->getMimeType() ]); } } }