Пример #1
0
 public function run()
 {
     DB::table('room_info')->delete();
     \App\RoomInfo::create(array('room_no' => 'sic-201', 'location' => '2nd floor, C block', 'room_type' => 'classroom', 'capacity' => '70', 'facility' => 'AC'));
     \App\RoomInfo::create(array('room_no' => 'sic-205', 'location' => '2nd floor, C block', 'room_type' => 'classroom', 'capacity' => '40', 'facility' => 'AC'));
     \App\RoomInfo::create(array('room_no' => 'sic-301', 'location' => '3nd floor, C block', 'room_type' => 'classroom', 'capacity' => '70', 'facility' => 'AC'));
 }
Пример #2
0
 public static function getRoomsGreaterThanCapacity($cap)
 {
     $mincap = RoomInfo::where('capacity', '>=', $cap)->min('capacity');
     //        dd($mincap);
     if (!$mincap) {
         $lsofrooms = ["msg" => "No rooms of this capacity available"];
     } else {
         $lsofrooms = RoomInfo::whereIn('capacity', [$mincap])->lists('room_no');
     }
     return $lsofrooms;
 }
Пример #3
0
 /**
  * Return the list of rooms with capacity greater than the argument passed
  *
  * @param Request $request
  * @return array|string
  */
 public function getroomswithcap(Request $request)
 {
     //		if ( Session::token() !== Input::get( '_token' ) ) {
     //			return Response::json( array(
     //				'msg' => 'Unauthorized attempt to create setting'
     //			) );
     //		}
     if ($request->ajax()) {
         //		return "AJAX";
         $data = $request->get('data1');
         $availrooms = RoomInfo::getRoomsGreaterThanCapacity($data);
         return $availrooms;
         //		return \Response::json(['success'=>true,'data'=>$data]);
         //		return \Response::json(array(
         //			'success' => true,
         //			'data'   => $data
         //		));
         //		return Response::json($data);
         //		return Response::json($response);
     } else {
         return "HTTP";
     }
 }
Пример #4
0
 /**
  * View Current Rooms
  *
  * @param Request $request
  * @return $this
  */
 public function viewroom(Request $request)
 {
     $lsofrooms = RoomInfo::getallRooms();
     return view('viewroom')->with(['lsofrooms' => $lsofrooms]);
     //		return view('viewroom');
 }