document = $document; $this->type = $type; $this->pdfContent = $pdfContent; } /** * Get the message envelope. */ public function envelope(): Envelope { $subject = $this->type === 'quote' ? "Votre devis Thanasoft : " . $this->document->reference : "Votre facture Thanasoft : " . $this->document->invoice_number; return new Envelope( subject: $subject, ); } /** * Get the message content definition. */ public function content(): Content { return new Content( view: 'emails.document', ); } /** * Get the attachments for the message. * * @return array */ public function attachments(): array { $filename = $this->type === 'quote' ? 'Devis_' . $this->document->reference . '.pdf' : 'Facture_' . $this->document->invoice_number . '.pdf'; return [ Attachment::fromData(fn () => $this->pdfContent, $filename) ->withMime('application/pdf'), ]; } }