/** * Display a listing of the resource. * GET /rooms * * @return Response */ public function index() { $all = Rooms::all(); $rooms = Rooms::join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->paginate(5, ['roomtype.RoomType_Name', 'roomtype_pic.Picture', DB::raw("CONCAT(SUBSTRING(roomtype.Description, 1, 100), '...') as IsiRoom"), 'roomtype.ID_RoomType']); $count = Rooms::where('Status', '=', 'Active')->get()->count(); $listRooms = Rooms::where('Status', '=', 'Active')->get(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); return View::make('Rooms.index', compact('rooms', 'roomPic', 'all'))->with('room_active', 'active')->with('count', $count)->with('listRoom', $listRooms)->with('data', $data); }
public function indexTravel() { $getoff_id = Offer::where('Status', '=', 'Active')->get(); $offer = Offer::join('detail_offer', 'detail_offer.ID_Offer', '=', 'offer.ID_Offer')->join('roomtype_pic', 'roomtype_pic.ID_RoomType', '=', 'detail_offer.ID_RoomType')->join('roomtype', 'roomtype.ID_RoomType', '=', 'detail_offer.ID_RoomType')->where('offer.Status', '=', 'Active')->where('roomtype_pic.Main_Pic', '=', 'YES')->get(); $countOffer = Offer::where('Status', '=', 'Active')->count(); $countDetail = DetailOffer::join('offer', 'offer.ID_Offer', '=', 'detail_offer.ID_Offer')->where('offer.Status', '=', 'Active')->count(); $rooms = Rooms::join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->paginate(5, ['roomtype.RoomType_Name', 'roomtype.Price', 'roomtype_pic.Picture', DB::raw("CONCAT(SUBSTRING(roomtype.Description, 1, 100), '...') as IsiRoom"), 'roomtype.ID_RoomType']); $data['about'] = About::get()->all(); $travel = Travel::where('ID_Travel', '=', Cache::get('travel_session'))->where('Status', '=', 'Active')->get(); return View::make('Books.Travel.index', compact('rooms'))->with('travel', $travel)->with('data', $data)->with('countOffer', $countOffer)->with('offer', $offer)->with('countDetail', $countDetail); }