Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Pages::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, 'page' => $this->page, 'status' => $this->status, 'order' => $this->order]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'page', $this->page])->andFilterWhere(['like', 'keyword', $this->keyword])->andFilterWhere(['like', 'text', $this->text])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
Beispiel #2
0
 public function actionIndex()
 {
     $model = Rooms::find()->where(['status' => 1])->all();
     $page = Pages::find()->where(['page' => 'rooms'])->one();
     return $this->render('index', ['model' => $model, 'page' => $page]);
 }
Beispiel #3
0
 public function actionContact()
 {
     $pages = Pages::find()->where(['page' => 'contact'])->one();
     return $this->render('contact', ['page' => $pages]);
 }