/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = JumperInfo::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ["pageSize" => 10]]); $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]); $query->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'port', $this->port])->andFilterWhere(['like', 'wire_frame', $this->wire_frame])->andFilterWhere(['like', 'wire_position', $this->wire_position])->andFilterWhere(['like', 'point', $this->point])->andFilterWhere(['like', 'insert_no', $this->insert_no])->andFilterWhere(['like', 'tag', $this->tag]); $query->orderBy('id desc'); return $dataProvider; }
/** * Finds the JumperInfo model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return JumperInfo the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = JumperInfo::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }