Deploy to Production (witstore.wende.it) / deploy (push) Successful in 7s
- E-Mail-Templates: DB-gespeicherte HTML-Templates mit {{placeholder}}-System,
Admin-UI zum Bearbeiten von Betreff und Body, alle 4 Mailables aktualisiert
- Seiten-Layouts: 4 Layouts für CMS-Seiten (Standard, Sidebar, Volle Breite, Landing),
Layout-Auswahl im Admin-Formular
- Shop-Themes: 5 Farbthemen via CSS-Variablen, Picker in Einstellungen
- Deployment: EmailTemplateSeeder wird automatisch beim Deploy ausgeführt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
50 lines
1.5 KiB
PHP
50 lines
1.5 KiB
PHP
<?php
|
||
|
||
namespace App\Mail;
|
||
|
||
use App\Models\EmailTemplate;
|
||
use App\Models\Order;
|
||
use App\Models\Setting;
|
||
use Illuminate\Bus\Queueable;
|
||
use Illuminate\Mail\Mailable;
|
||
use Illuminate\Queue\SerializesModels;
|
||
|
||
class PaymentReceivedMail extends Mailable
|
||
{
|
||
use Queueable, SerializesModels;
|
||
|
||
public function __construct(
|
||
public Order $order,
|
||
private string $pdfContent,
|
||
private string $pdfFilename,
|
||
) {}
|
||
|
||
public function build()
|
||
{
|
||
$order = $this->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']);
|
||
}
|
||
}
|