/**
  * This function is used to load the room modal contents.This function response to
  *a ajax call.
  *
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function roomViewLoad(Request $request)
 {
     $inputs = $request::all();
     $room_id = $inputs['room_id'];
     $image1 = ROOM_IMAGE::where('room_type_id', '=', $room_id)->first();
     if (!empty($image1)) {
         $images = ROOM_IMAGE::where('room_type_id', '=', $room_id)->where('path', '!=', $image1->path)->select('path')->get();
         $path = $image1->path;
     } else {
         $images = array();
         $path = null;
     }
     $room_furnishes = RoomTypeFurnish::where('room_type_id', '=', $room_id)->join('ROOM_FURNISHING', 'ROOM_TYPE_FURNISH.furnish_id', '=', 'ROOM_FURNISHING.rf_id')->select('name')->get();
     $room_services = RoomTypeService::where('room_type_id', '=', $room_id)->join('ROOM_SERVICES', 'ROOM_TYPE_SERVICE.service_id', '=', 'ROOM_SERVICES.rs_id')->select('name')->get();
     $room_rates = RATE::join('MEAL_TYPES', 'RATES.meal_type_id', '=', 'MEAL_TYPES.meal_type_id')->where('RATES.room_type_id', '=', $room_id)->select('MEAL_TYPES.meal_type_name', 'RATES.rate_code', 'RATES.single_rates')->get();
     $arr_dep_time = DB::table('HOTEL_INFO')->select('check_in', 'check_out')->first();
     if (!empty($arr_dep_time)) {
         $checkin = $arr_dep_time->check_in;
         $checkout = $arr_dep_time->check_out;
     } else {
         $checkin = null;
         $checkout = null;
     }
     return response()->json(['rimage1' => $path, 'rimages' => $images, 'room_furnishes' => $room_furnishes, 'room_services' => $room_services, 'room_rates' => $room_rates, 'check_in' => $checkin, 'check_out' => $checkout]);
 }
Пример #2
0
 /**
  * edit room tye info
  *
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  *
  */
 public function admin_edit_roomtype(Request $request)
 {
     $roomType = RoomType::find($request->input('id'));
     $id = $request->input('id');
     $rate = DB::select(DB::raw("select a.*,\n        (select b.meal_type_name from MEAL_TYPES b  where b.meal_type_id = a.meal_type_id) as meal\n        from RATES a where a.room_type_id = '{$id}'"));
     //RATE::where('room_type_id',$request->input('id'))->get();
     $images = ROOM_IMAGE::where('room_type_id', $request->input('id'))->get();
     $rf = RoomTypeFurnish::where('room_type_id', $request->input('id'))->get();
     $rs = RoomTypeService::where('room_type_id', $request->input('id'))->get();
     return response()->json(['info' => $roomType, 'images' => $images, 'rs' => $rs, 'rf' => $rf, 'rate' => $rate]);
 }