Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 /**
  * 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.');
     }
 }