/**
  * Display a listing of the resource.
  * GET /booking
  * 
  * @return Response
  */
 public function index()
 {
     if (Session::has('checkin') && Session::has('checkout') && Session::has('reserved_room_id')) {
         $checkin = Session::get('checkin');
         $checkout = Session::get('checkout');
         $room_id = Session::get('reserved_room_id');
         $room_details = Room::where('id', $room_id)->select('id', 'name', 'price')->first();
         $available_rooms = 0;
         $room1 = [];
         //$roomDetails = Room::where('id')->first();
         $room = RoomQty::where('room_id', Session::get('reserved_room_id'))->with(array('roomReserved' => function ($query) {
             $query->whereBetween('check_in', array(Session::has('checkin'), Session::has('checkout')))->orWhereBetween('check_out', array(Session::has('checkin'), Session::has('checkout')))->orWhereRaw('"' . Session::has('checkin') . '" between check_in and check_out')->orWhereRaw('"' . Session::has('checkout') . '" between check_in and check_out')->where('status', '!=', 5);
         }))->get();
         foreach ($room as $r) {
             if ($r->roomReserved->count() == 0 && $r->status == 1) {
                 $available_rooms++;
             }
         }
         $room = $room->toArray();
         $room1['quantity'] = $room;
         $room1['available_rooms'] = $available_rooms;
         $cpage = 'booking';
         return View::make('clientview.booking.index', compact('cpage', 'available_rooms', 'room_details'));
     } else {
         return Redirect::to('/');
     }
 }
 Route::get('dashboard/departure/aPassword::sendReminder(user, token, callback)jax', 'DashboardController@ajax_todayDeparture');
 Route::get('dashboard/occupied_booking/ajax', 'DashboardController@ajax_todayBookingOccupied');
 Route::get('dashboard/preparing_booking/ajax', 'DashboardController@ajax_todayBookingPreparing');
 Route::get('dashboard/success_booking', 'DashboardController@todayBookingSuccess');
 Route::get('dashboard/cancelled_booking', 'DashboardController@todayBookingCancelled');
 Route::get('dashboard/pending_booking', 'DashboardController@todayBookingPending');
 Route::get('dashboard/arrival', 'DashboardController@todayArrival');
 Route::get('dashboard/departure', 'DashboardController@todayDeparture');
 Route::get('dashboard/occupied', 'DashboardController@todayBookingOccupied');
 Route::get('dashboard/preparing', 'DashboardController@todayBookingPreparing');
 Route::get('reservation/list/ajax', 'BookingController@thisYearList');
 Route::get('activity', 'ActivitiesController@index');
 Route::get('room', 'RoomController@index');
 Route::get('room/all', 'RoomController@allrooms');
 Route::get('room/search/{query}', function ($query) {
     $r = RoomQty::where('room_no', $query)->first();
     if (!empty($r)) {
         $room_id = $r->room_id;
         $rooms = Room::with('roomQty', 'roomImages.photo')->where('id', $room_id)->get();
         //return 'heyt';
         return $rooms;
     } else {
         return '0';
     }
     return 'hey';
 });
 Route::get('user', 'UsersController@index');
 Route::post('user/create', 'UsersController@store');
 Route::post('user/{id}/delete', 'UsersController@destroy');
 Route::post('user/{id}/update', 'UsersController@update');
 Route::get('settings', function () {
 public function updateSpecific($id)
 {
     $i = Input::all();
     $today = Date('Y-m-d H:i:s');
     $tomorrow = new DateTime('tomorrow');
     $tomorrow = $tomorrow->format('Y-m-d') . ' 11:59:00';
     $r = RoomQty::where('id', $id)->with(array('roomReserved' => function ($query) use($today, $tomorrow) {
         $query->where(function ($query2) use($today, $tomorrow) {
             $query2->whereBetween('check_in', array($today, $tomorrow))->orWhereBetween('check_out', array($today, $tomorrow))->orWhereRaw('"' . $today . '" between check_in and check_out')->orWhereRaw('"' . $tomorrow . '" between check_in and check_out');
         })->where(function ($query3) {
             $query3->where('status', '!=', 5)->where('status', '!=', 3);
         });
     }))->first();
     if (!empty($r)) {
         $r->room_no = $i['room_no'];
         $r->status = $i['status'];
         if ($r->save()) {
             return $r;
         } else {
             return '0';
             //means failed
         }
     }
 }