fixBookingTable

This commit is contained in:
lonetrinity
2018-08-17 14:57:33 +08:00
parent 408be5d367
commit a85b8eb41e
3 changed files with 6189 additions and 9173 deletions
+23 -7
View File
@@ -35,6 +35,8 @@ class BookingController extends Controller
->orderby('updated_at','desc')
->paginate(10);
// reformat to fit frontend structure
foreach ($bookings as $booking) {
// set timeout
@@ -94,8 +96,18 @@ class BookingController extends Controller
$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 ( "status" ,'=','6')
->orWhere( "status" ,'=','5')
->where('status', '=', '5')
->where(function ($query) {
$query->where('term', '=', 'x2_cash')
->orwhere('term', '=', 'x2_cheque')
->orwhere('term', '=', 'x2_ba');
})
->orwhere('status', '=', '7')
->where(function ($query) {
$query->where('term', '=', 'x1_cash')
->orwhere('term', '=', 'x1_cheque')
->orwhere('term', '=', 'x1_ba');
})
->orderby('updated_at','desc')
->paginate(10);
@@ -161,11 +173,15 @@ class BookingController extends Controller
public function adminIndex(){
$user = Auth::user();
$bookings = Booking::select('user_id', 'id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
->where('admin_status', '=', '5')
->orwhere('admin_status', '=', '4')
->orwhere('admin_status', '=', '3')
->orwhere('admin_status', '=', '2')
->orwhere('admin_status', '=', '1')
->where('admin_status', '<', '6')
->orwhere(function ($query) {
$query->where('admin_status', '!=', '7');
}, function ($query) {
$query->where('term', '=', 'x1_cheque')
->orwhere('term', '=', 'x1_ba')
->orwhere('term', '=', 'x1_cash');
})
->orderby('updated_at','desc')
->paginate(10);