From 3a34519ffa56579c44e1bd832f37ec67404b7212 Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Thu, 20 Dec 2018 18:06:17 +0800 Subject: [PATCH] admin user bookings --- app/Http/Controllers/BookingController.php | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php index a4ccf7a1..0fa13b3d 100644 --- a/app/Http/Controllers/BookingController.php +++ b/app/Http/Controllers/BookingController.php @@ -190,12 +190,23 @@ class BookingController extends Controller public function adminIndex(?string $userId = null){ $user = Auth::user(); $bookings = Booking::UserBooking($userId)->select('user_id', 'id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status') - ->where('admin_status', '<', '6') - ->orwhere(function ($query) { - $query->where('admin_status', '=', '6') - ->where('term', '!=', 'x2_cheque') - ->where('term', '!=', 'x2_ba') - ->where('term', '!=', 'x2_cash'); + ->where(function ($query) { + $query->where(function ($query) { + $query->where('admin_status', '<', '6') + ->where(function ($query) { + $query->where('term', 'x2_cash') + ->orwhere('term', 'x2_cheque') + ->orwhere('term', 'x2_ba'); + }); + }) + ->orwhere(function ($query) { + $query->where('status', '<', '7') + ->where(function ($query) { + $query->where('term', 'x1_cash') + ->orwhere('term', 'x1_cheque') + ->orwhere('term', 'x1_ba'); + }); + }); }) ->orderby('updated_at','desc') ->paginate(30);