public function listRoomByIcon() { // hien thi danh sach phong bang icon $data['title'] = 'Room Preview'; $data['room'] = Room::all(); $data['room_type'] = RoomType::all(); return view('default/listRoomByIcon', $data); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return response()->json(RoomType::all()); }
public function index() { $room_types = RoomType::all(); return $room_types; }
/** * dashboard view with all the statistics * @return mixed */ public function dash() { $roomWeek = DB::select(DB::raw("select * from ROOM_RESERVATION A\nLEFT JOIN CUSTOMER B ON A.cus_id = B.cus_id\nWHERE A.status = 'ACCEPTED'\nAND A.check_in < DATE_ADD(NOW(),INTERVAL 7 DAY)\nAND A.check_in > DATE_SUB(NOW(),INTERVAL 1 DAY)\nOrder by A.check_in ASC")); $hallWeek = DB::select(DB::raw("Select A.*, B.*, (select C.title from HALLS C where C.hall_id = A.hall_id) as title from HALL_RESERVATION A\nLEFT JOIN CUSTOMER B ON A.cus_id = B.cus_id\nWHERE A.status = 'ACCEPTED'\nAND A.reserve_date < DATE_ADD(NOW(),INTERVAL 7 DAY)\nAND A.reserve_date > DATE_SUB(NOW(),INTERVAL 1 DAY)\nOrder by A.reserve_date ASC;")); $checkout = DB::select(DB::raw("select * from ROOM_RESERVATION A\nLEFT JOIN CUSTOMER B ON A.cus_id = B.cus_id\nWHERE A.status IN ('ACCEPTED','CHECKED IN')\nAND DATE_FORMAT(A.check_out,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')\nOrder by A.check_out ASC;")); $reservationCount = DB::select(DB::raw("Select count(*) as pending,\n(select count(*) from ROOM_RESERVATION A where A.status NOT IN('PENDING','REJECTED','CANCELLED') AND A.check_in > NOW()) as accepted,\n(select count(*) from HALL_RESERVATION A where A.status NOT IN('PENDING','REJECTED','CANCELLED') AND A.reserve_date > NOW()) as accepted_hall,\n(select count(*) from HALL_RESERVATION A where A.status = 'PENDING' AND A.reserve_date > NOW()) as pending_hall\n from ROOM_RESERVATION A where A.status = 'PENDING' AND A.check_in > NOW()")); $roomInfo = DB::select(DB::raw("Select count(room_id) as count,\n(select B.type_name from ROOM_TYPES B where B.room_type_id = A.room_type_id) as type_name\n from ROOMS A Where A.status = 'AVAILABLE'\nGroup by A.room_type_id")); $ongoing = DB::select(DB::raw("select * from ROOM_RESERVATION A\nLEFT JOIN CUSTOMER B ON A.cus_id = B.cus_id\nWHERE A.status = 'CHECKED IN'")); $roomTypes = RoomType::all(); return view('nilesh.dash')->with('reservationCount', $reservationCount)->with('roomWeek', $roomWeek)->with('checkout', $checkout)->with('roomInfo', $roomInfo)->with('roomTypes', $roomTypes)->with('ongoing', $ongoing)->with('hallWeek', $hallWeek); }