order; $template = EmailTemplate::getByKey('payment_received'); if (!$template) { return $this ->subject('Ihre Rechnung – ' . $order->order_number . ' – ' . Setting::get('shop_name')) ->view('emails.payment_received') ->attachData($this->pdfContent, $this->pdfFilename, ['mime' => 'application/pdf']); } $customerName = $order->billingAddress()?->full_name ?? $order->guest_email; $data = [ 'customer_name' => $customerName, 'order_number' => $order->order_number, 'order_total' => number_format($order->total, 2, ',', '.'), 'shop_name' => Setting::get('shop_name'), 'shop_email' => Setting::get('shop_email'), ]; return $this ->subject($template->renderSubject($data)) ->html($template->renderBody($data)) ->attachData($this->pdfContent, $this->pdfFilename, ['mime' => 'application/pdf']); } }