/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Procurement_item::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['ID' => $this->ID, 'PARENT' => $this->PARENT, 'SORT_PATENT' => $this->SORT_PATENT, 'PRC_BRG_ID' => $this->PRC_BRG_ID, 'KATEGORI' => $this->KATEGORI, 'GROUP' => $this->GROUP, 'TGL_START' => $this->TGL_START, 'TGL_END' => $this->TGL_END, 'UPDATED_TIME' => $this->UPDATED_TIME]); $query->andFilterWhere(['like', 'PRC_BRG_NM', $this->PRC_BRG_NM])->andFilterWhere(['like', 'PRC_BRG_SPEK', $this->PRC_BRG_SPEK])->andFilterWhere(['like', 'PRC_BRG_DCRP', $this->PRC_BRG_DCRP])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY]); return $dataProvider; }
/** * Finds the Procurement_item model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Procurement_item the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Procurement_item::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }