public function getRateData($hotelid)
 {
     $room_id = Input::get('room_type_id');
     $roomspaces = RoomType::with('roomSpecification')->find($room_id);
     return Response::json(array($roomspaces, MealBasis::all()));
 }
 public function addToCart()
 {
     $hot_id = Input::get('hotel_id');
     if (Input::has('room_refer_id')) {
         $room_identity = Input::get('room_refer_id');
         $room_identity_array = explode("_", $room_identity);
         $hotel_id = $room_identity_array[0];
         $room_id = $room_identity_array[1];
         $room_specification_id = $room_identity_array[2];
         $meal_basis_id = $room_identity_array[3];
         $room_count = Session::get('room_count');
         $hotel_name = Hotel::where('id', $hotel_id)->first()->name;
         $hotel_address = Hotel::where('id', $hotel_id)->first()->address;
         $room_name = RoomType::where('id', $room_id)->first()->room_type;
         $room_specification = RoomSpecification::where('id', $room_specification_id)->first()->room_specification;
         $meal_basis = MealBasis::where('id', $meal_basis_id)->first()->meal_basis_name;
         $adult = RoomSpecification::where('id', $room_specification_id)->first()->adults;
         $child = RoomSpecification::where('id', $room_specification_id)->first()->children;
         $nights = Session::get('date_gap');
         $st_date = date('Y-m-d', strtotime(Session::get('st_date')));
         $ed_date = date('Y-m-d', strtotime(Session::get('ed_date')));
         $date_count = Voucher::getNights($st_date, $ed_date)->days;
         //dd($room_id.'/'.$room_specification_id.'/'.$meal_basis_id);
         $room_rate = Rate::lowestRoomRate($hotel_id, $room_id, $room_specification_id, $meal_basis_id, $st_date, $ed_date);
         $room_rate_with_tax = Rate::lowestRoomRateWithTax($hotel_id, $room_id, $room_specification_id, $meal_basis_id, $st_date, $ed_date);
         $room_cost = $room_rate_with_tax * $room_count * $date_count;
         if (Session::has('market')) {
             $market = Session::get('market');
         } else {
             $market = 1;
         }
         $get_market_details = Market::where('id', $market)->first();
         $tax_type = $get_market_details->tax_type;
         $tax = $get_market_details->tax;
         $handling_fee_type = $get_market_details->handling_fee_type;
         $handling_fee = $get_market_details->handling_fee;
         $supplement_rate = Rate::supplementRate($hotel_id, $room_id, $room_specification_id, $meal_basis_id, $st_date, $ed_date);
         if ($market == 1) {
             if ($tax_type == 0) {
                 $total_tax = $room_rate_with_tax / 100 * $tax;
             } else {
                 $total_tax = $tax;
             }
             if ($handling_fee_type == 0) {
                 $total_handling_fee = $room_rate / 100 * $handling_fee;
             } else {
                 $total_handling_fee = $handling_fee;
             }
             $hotel_handling_fee = $total_handling_fee;
             $hotel_tax = $total_tax;
         } else {
             $total_tax = 0;
             if ($handling_fee_type == 0) {
                 $total_handling_fee = $room_rate / 100 * $handling_fee;
             } else {
                 $total_handling_fee = $handling_fee;
             }
             $hotel_tax = $total_tax;
             $hotel_handling_fee = $total_handling_fee;
         }
         $rate_box_details = array('hotel_id' => $hotel_id, 'hotel_name' => $hotel_name, 'hotel_address' => $hotel_address, 'room_name' => $room_name, 'room_type_id' => $room_id, 'room_specification' => $room_specification, 'room_specification_id' => $room_specification_id, 'meal_basis' => $meal_basis, 'meal_basis_id' => $meal_basis_id, 'room_cost' => $room_cost, 'hotel_tax' => $hotel_tax, 'hotel_handling_fee' => $hotel_handling_fee, 'supplement_rate' => $supplement_rate, 'room_count' => $room_count, 'unit_price' => $room_rate_with_tax, 'hotel_room_price' => $room_rate, 'adult' => $adult, 'child' => $child, 'nights' => $nights, 'room_identity' => $room_identity, 'check_in' => $st_date, 'check_out' => $ed_date, 'unit_cost_price' => (double) $hotel_tax + (double) $room_cost);
         if (Session::has('rate_box_details_' . $hotel_id)) {
             $data = Session::get('rate_box_details_' . $hotel_id);
             $data[$room_identity] = $rate_box_details;
         } else {
             $data = [];
             $data[$room_identity] = $rate_box_details;
         }
         Session::put('rate_box_details_' . $hotel_id, $data);
     }
     //dd(Session::get('rate_box_details_'.$hotel_id));
     return Response::json($hotel_id);
 }