fix: use salesOrder.customer path in DeliveryNote dispatch notification

This commit is contained in:
Ghassan Yusuf 2026-05-19 13:22:17 +03:00
parent a1f6e765e1
commit fddfb2aaff

View File

@ -146,8 +146,10 @@ class DeliveryNoteController extends Controller
} }
}); });
if ($deliveryNote->customer && $deliveryNote->customer->whatsapp_number) { $deliveryNote->loadMissing('salesOrder.customer');
$deliveryNote->customer->notify(new DeliveryDispatchedNotification($deliveryNote)); $customer = $deliveryNote->salesOrder?->customer;
if ($customer && $customer->whatsapp_number) {
$customer->notify(new DeliveryDispatchedNotification($deliveryNote));
} }
return redirect()->back()->with('success', 'Delivery note dispatched and stock decremented.'); return redirect()->back()->with('success', 'Delivery note dispatched and stock decremented.');