public function search($params) { $query = CMS::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['cms_id' => $this->cms_id]); $query->andFilterWhere(['like', 'cms_name', $this->cms_name])->andFilterWhere(['like', 'cms_content', $this->cms_content]); return $dataProvider; }
/** * Finds the CMS model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CMS the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CMS::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }