From 98732a6d6287dace625fb4e613332ecdd30ec4c2 Mon Sep 17 00:00:00 2001 From: Jack Goh Date: Thu, 23 Aug 2018 10:55:14 +0800 Subject: [PATCH] fix all user's booking in booking table to specifc user only --- app/Http/Controllers/BookingController.php | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php index ef35dd35..a24941b8 100644 --- a/app/Http/Controllers/BookingController.php +++ b/app/Http/Controllers/BookingController.php @@ -22,30 +22,30 @@ class BookingController extends Controller { public function index(){ - \DB::connection()->enableQueryLog(); $user = Auth::user(); $bookings = Booking::select('user_id', 'id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status') ->where('user_id', Auth::user()->id) ->where(function ($query) { - $query->where('status', '<', '5') - ->where(function ($query) { - $query->where('term', '=', 'x2_cheque') - ->orwhere('term', '=', 'x2_ba') - ->orwhere('term', '=', 'x2_cash'); - }); - }) - ->orwhere(function ($query) { - $query->where('status', '<', '7') + $query->where(function($query){ + $query->where('status', '<', '5') ->where(function ($query) { - $query->where('term', '=', 'x1_cheque') - ->orwhere('term', '=', 'x1_ba') - ->orwhere('term', '=', 'x1_cash'); - }); + $query->where('term', '=', 'x2_cheque') + ->orwhere('term', '=', 'x2_ba') + ->orwhere('term', '=', 'x2_cash'); + }); }) + ->orwhere(function ($query) { + $query->where('status', '<', '7') + ->where(function ($query) { + $query->where('term', '=', 'x1_cheque') + ->orwhere('term', '=', 'x1_ba') + ->orwhere('term', '=', 'x1_cash'); + }); + }); + }) ->orderby('updated_at','desc') ->paginate(10); - $queries = \DB::getQueryLog(); - //return print_r($queries); + // reformat to fit frontend structure foreach ($bookings as $booking) { // set timeout