/** * Display a listing of the resource. * * @return Response */ public function index($filter = 'chinh-chu') { $userId = Auth::user()->id; switch ($filter) { case ConstHelper::URI_CHINH_CHU: $resources = $this->houseModel->getHousesManagement()->isOwner(OwnerTypeOptions::CHINH_CHU)->where('user_id', $userId)->paginate(6); break; case ConstHelper::URI_MOI_GIOI: $resources = $this->houseModel->getHousesManagement()->isOwner(OwnerTypeOptions::MOI_GIOI)->where('user_id', $userId)->paginate(6); break; case ConstHelper::URI_DU_AN: $resources = $this->projectModel->getProjectsManagement()->where('user_id', $userId)->paginate(6); break; } return view('manage.house.managements.index', compact('resources', 'filter')); }
public function index(Request $request, $type) { $isApproved = $request->get('isApproved', 0); switch ($type) { case 1: // ban $resources = $this->houseModel->getHousesManagement()->saleType(SaleTypeOptions::BAN); break; case 2: // cho thue $resources = $this->houseModel->getHousesManagement()->saleType(SaleTypeOptions::CHO_THUE); break; case 3: // du an $resources = $this->projectModel->getProjectsManagement(); break; } $resources = $resources->isApproved($isApproved)->paginate(9); return view('admin.managements.index', compact('resources', 'type')); }