*/ public array $backoff = [60, 300, 900, 3600]; public string $invoicesUrl; public function __construct( public readonly User $user, public readonly Invoice $invoice, public readonly bool $attachPdf = false, public readonly bool $forInvoiceRecipient = false, ) { $this->invoicesUrl = route('me.invoices.index'); } public function envelope(): Envelope { // Blindkopie an das Rechts-/Service-Postfach: interner Beleg über // jede versendete Zahlungsbestätigung. // Die Fassung an die Rechnungs-E-Mail ist ein Duplikat derselben // Rechnung — eine Blindkopie davon braucht das Postfach nicht. $bcc = $this->forInvoiceRecipient ? '' : (string) config('legal.contact_email'); return new Envelope( subject: $this->forInvoiceRecipient ? 'Rechnung '.$this->invoice->number.' — pressekonto' : 'Zahlungsbestätigung für Ihre Buchung — Rechnung '.$this->invoice->number, bcc: $bcc !== '' ? [$bcc] : [], ); } public function content(): Content { return new Content(view: 'emails.billing.payment-confirmed'); } /** * @return array */ public function attachments(): array { if (! $this->attachPdf || blank($this->invoice->stripe_invoice_id)) { return []; } $pdf = app(StripeInvoicePdf::class); return [ Attachment::fromData(fn (): string => $pdf->contents($this->invoice), $pdf->filename($this->invoice)) ->withMime('application/pdf'), ]; } }