@php use Carbon\Carbon; $status = strtolower($appointment->status); $patientName = $appointment->patient_name ?? 'Patient'; $doctorName = $appointment->doctor_name ?? 'Doctor'; $notes = $appointment->cancellation_reason ?? 'No notes'; $appointmentID = $appointment->booking_reference ?? '00'; $date = Carbon::parse($appointment->appointment_date)->format('d M Y'); $time = Carbon::parse($appointment->start_time)->format('h:i A'); // Dynamic Heading $heading = match($status) { 'completed' => 'Consultation Completed', 'cancelled', 'patient_cancelled', 'doctor_cancelled' => 'Appointment Cancelled', 'confirmed' => 'Appointment Confirmed', 'rescheduled' => 'Appointment Rescheduled', default => 'Appointment Update', }; // Dynamic Message $message = match($status) { 'completed' => "Your consultation with {$doctorName} has been completed successfully.", 'cancelled', 'patient_cancelled', 'doctor_cancelled' => "Your appointment with {$doctorName} has been cancelled.", 'confirmed' => "Your appointment with {$doctorName} has been confirmed.", 'rescheduled' => "Your appointment has been rescheduled. Please check updated details.", default => "Your appointment status has been updated.", }; @endphp