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>
51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
||
|
||
namespace App\Mail;
|
||
|
||
use App\Models\EmailTemplate;
|
||
use App\Models\Setting;
|
||
use Illuminate\Bus\Queueable;
|
||
use Illuminate\Mail\Mailable;
|
||
use Illuminate\Queue\SerializesModels;
|
||
|
||
class WiderrufsformularMail extends Mailable
|
||
{
|
||
use Queueable, SerializesModels;
|
||
|
||
public function __construct(
|
||
public array $data,
|
||
public bool $isConfirmation = false,
|
||
) {}
|
||
|
||
public function build()
|
||
{
|
||
if (!$this->isConfirmation) {
|
||
$subject = 'Neues Widerrufsformular eingegangen';
|
||
return $this->subject($subject)->view('emails.widerruf');
|
||
}
|
||
|
||
$template = EmailTemplate::getByKey('widerruf_confirmation');
|
||
|
||
if (!$template) {
|
||
return $this
|
||
->subject('Bestätigung Ihres Widerrufs – ' . Setting::get('shop_name'))
|
||
->view('emails.widerruf');
|
||
}
|
||
|
||
$vars = [
|
||
'customer_name' => $this->data['name'],
|
||
'widerruf_name' => $this->data['name'],
|
||
'widerruf_email' => $this->data['email'],
|
||
'widerruf_order_number' => $this->data['order_number'] ?? '—',
|
||
'widerruf_product' => $this->data['product'],
|
||
'widerruf_date' => $this->data['date'],
|
||
'widerruf_reason' => $this->data['reason'] ?? '—',
|
||
'shop_name' => Setting::get('shop_name'),
|
||
];
|
||
|
||
return $this
|
||
->subject($template->renderSubject($vars))
|
||
->html($template->renderBody($vars));
|
||
}
|
||
}
|