Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Faq::find();
     $dataProvider = new ActiveDataProvider(['query' => $query->where(['status' => [Status::STATUS_ACTIVE, Status::STATUS_INACTIVE]])]);
     $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, 'faq_order' => $this->faq_order, 'is_disabled' => $this->is_disabled, 'status' => $this->status, 'created_date' => $this->created_date, 'modified_date' => $this->modified_date]);
     $query->andFilterWhere(['like', 'question', $this->question])->andFilterWhere(['like', 'answer', $this->answer])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'modified_by', $this->modified_by]);
     return $dataProvider;
 }
Пример #2
0
 public function actionIndex()
 {
     $model = new Faq();
     $dataProvider = new ActiveDataProvider(['query' => Faq::find()]);
     return $this->render('faq', ['dataProvider' => $dataProvider, 'model' => $model]);
 }
Пример #3
0
 public function actionFaq()
 {
     return $this->render('faq', ['list' => Faq::find()->where(['active' => 1])->orderBy('id asc')->all(), 'subjects' => Subject::find()->all()]);
 }