@php $notifType = $notifType ?? ''; $details = $details ?? []; $amountFmt = 'CA$' . number_format((float) ($details['amount'] ?? 0), 2); $meta = [ 'invoice_created' => ['heading' => 'New Invoice', 'intro' => 'A new invoice has been created for your child\'s classes at ' . config('company.short') . '.', 'cta' => 'View & Pay'], 'payment_reminder' => ['heading' => 'Payment Reminder', 'intro' => 'This is a friendly reminder that you have an outstanding payment due.', 'cta' => 'Pay Now'], 'payment_received' => ['heading' => 'Payment Received', 'intro' => 'We\'ve received your payment. Thank you!', 'cta' => null], ]; $m = $meta[$notifType] ?? ['heading' => config('company.short') . ' Notification', 'intro' => '', 'cta' => null]; $rows = []; if (!empty($details['invoiceNumber'])) $rows[] = ['label' => 'Invoice #', 'value' => $details['invoiceNumber']]; if (!empty($details['studentName'])) $rows[] = ['label' => 'Student', 'value' => $details['studentName']]; $rows[] = ['label' => 'Amount', 'value' => $amountFmt]; if (isset($details['remaining'])) $rows[] = ['label' => 'Balance Due', 'value' => 'CA$' . number_format((float) $details['remaining'], 2)]; if (!empty($details['dueDate'])) $rows[] = ['label' => 'Due Date', 'value' => $details['dueDate']]; if (!empty($details['transactionId']))$rows[] = ['label' => 'Reference', 'value' => $details['transactionId']]; @endphp Hi {{ $recipientName }}, @include('emails.plain.generic', [ 'heading' => $m['heading'], 'intro' => $m['intro'], 'rows' => $rows, 'ctaLabel' => $m['cta'], 'ctaUrl' => $details['portalUrl'] ?? null, ])