data = $data; $this->file = $file; } /** * Build the message. * * @return $this */ public function build() { return $this ->subject(sprintf('Nouveau message consommateur Le Gaulois (%s)', $this->data->type->label())) ->view('emails.contact') ->text('emails.contact-plain') ->with('data', $this->data); } /** * Get the attachments for the message. * * @return array */ public function attachments(): array { if (!$this->file) { return []; } return [ Attachment::fromPath($this->file)->as($this->data->joinFile), ]; } }