diff --git a/routes/web.php b/routes/web.php index f0234e70..fae63d9b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1162,9 +1162,11 @@ Route::get('check-duplicate-refunds', function () { $booking_ref_click = ''.$booking_ref.''; $booking = Booking::where('marking', $booking_ref)->first(); - $payment = $booking->transactions()->where('type', TransactionType::PAYMENT)->first(); - $refund = $payment->transactions()->where('type', TransactionType::REFUND)->get()->pluck('id')->toArray(); - $refund = implode(',', $refund); + if ($booking) { + $payment = $booking->transactions()->where('type', TransactionType::PAYMENT)->first(); + $refund = $payment->transactions()->where('type', TransactionType::REFUND)->get()->pluck('id')->toArray(); + $refund = implode(',', $refund); + } } echo "$booking_ref_click"; echo "" . ($payment ? $payment->id : '') . "";