From fddfb2aaffe0bec729f9cb1418c2c0a5b1c1140c Mon Sep 17 00:00:00 2001 From: Ghassan Yusuf Date: Tue, 19 May 2026 13:22:17 +0300 Subject: [PATCH] fix: use salesOrder.customer path in DeliveryNote dispatch notification --- app/Http/Controllers/Sales/DeliveryNoteController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Sales/DeliveryNoteController.php b/app/Http/Controllers/Sales/DeliveryNoteController.php index f45ca52..e0e8ea1 100644 --- a/app/Http/Controllers/Sales/DeliveryNoteController.php +++ b/app/Http/Controllers/Sales/DeliveryNoteController.php @@ -146,8 +146,10 @@ class DeliveryNoteController extends Controller } }); - if ($deliveryNote->customer && $deliveryNote->customer->whatsapp_number) { - $deliveryNote->customer->notify(new DeliveryDispatchedNotification($deliveryNote)); + $deliveryNote->loadMissing('salesOrder.customer'); + $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.');