From 0680e995242df9c714a809ded106c8d1a69319b5 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 23 Sep 2020 14:56:53 +0800 Subject: [PATCH] fix bug with updating booking status to complete uppon invoice approval --- app/Http/Controllers/InvoiceController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index acd4e542..394ccf1a 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -315,7 +315,8 @@ class InvoiceController extends Controller // Change Status to 7 if approve // Add email event here if ($validatedData['status'] === 'approve') { - $booking = Booking::find($id); + + $booking = Booking::findOrFail($id); $booking->status = 7; $booking->admin_status = 7; $booking->save(); @@ -323,6 +324,8 @@ class InvoiceController extends Controller if(!$booking) { return response()->json(['message' => 'Unable to Complete Booking. Please Approve Again'], 500); } + + } // Response