예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Faq::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['faq_id' => $this->faq_id, 'faq_show_on_main' => $this->faq_show_on_main]);
     $query->andFilterWhere(['like', 'faq_title', $this->faq_title])->andFilterWhere(['like', 'faq_text', $this->faq_text])->andFilterWhere(['like', 'faq_language', $this->faq_language]);
     return $dataProvider;
 }
예제 #2
0
 public function run()
 {
     $models = Faq::find()->where(['faq_language' => \Yii::$app->language])->asArray()->all();
     return $this->render($this->viewPath, ['models' => $models, 'id' => $this->id, 'title' => $this->title, 'breadcrumbs' => $this->breadcrumbs]);
 }