public function clientBookingStep4() { /*foreach(Session::get('reservation')['reservation_room'] as $rooms) { $count++; $room_id = $rooms['room_details']['id']; $available_rooms = []; $room_qty = RoomQty::with(array('roomPrice','roomReserved'=>function($query) use($i, $room_id){ $query->where(function($query2) use ($i, $room_id){ $query2->whereBetween('check_in', array($i['checkin'], $i['checkout'])) ->orWhereBetween('check_out', array($i['checkin'], $i['checkout'])) ->orWhereRaw('"'.$i["checkin"].'" between check_in and check_out') ->orWhereRaw('"'.$i["checkout"].'" between check_in and check_out'); })->where(function($query3) { $query3->where('status', '!=', 5)->orWhere('status', '!=', 3); }); }))->where('room_id', $room_id)->where('status',1)->get(); foreach($room_qty as $available) { if($available->roomReserved== '[]' || count($available->roomReserved) == 0) { array_push($available_rooms, $available); } } if(count($available_rooms) < $rooms['quantity']) { return Redirect::to('booking/step2')->with('error', 'Some rooms you booked is not available'); } } */ try { $data = $total_price = 0; foreach (Session::get('reservation')['reservation_room'] as $reservation) { $total_price += $reservation['room_details']['price']; } if (Session::has('reservation.customerdiscount')) { $discount = new Discount(); Session::put('reservation.customerdiscountprice', $discount->calculateDiscount(1000, Session::get('reservation')['customerdiscount']['effect'], Session::get('reservation')['customerdiscount']['effect_type'])); } $ci = new Carbon(Session::get('reservation')['checkin']); $co = new Carbon(Session::get('reservation')['checkout']); $diff = $co->addMinutes(1)->diff($ci)->days; Session::put('reservation.nights', $diff); $cpage = 'booking.step4'; return View::make('clientview2.booking.step4', compact('cpage')); } catch (exception $e) { return $e; Session::forget('reservation'); return Redirect::to('booking')->with('error', 'Something went wrong. Please try again.'); } }