/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = WorkloadOp::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(['ref' => $this->ref, 'op_date' => $this->op_date]); $query->andFilterWhere(['like', 'an', $this->an])->andFilterWhere(['like', 'operate', $this->operate])->andFilterWhere(['like', 'op_type', $this->op_type])->andFilterWhere(['like', 'wound_type', $this->wound_type])->andFilterWhere(['like', 'ward', $this->ward])->andFilterWhere(['like', 'period', $this->period])->andFilterWhere(['like', 'prepare_type', $this->prepare_type]); return $dataProvider; }
/** * Finds the WorkloadOp model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return WorkloadOp the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = WorkloadOp::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }