Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = SongComment::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, 'song_id' => $this->song_id, 'comment_id' => $this->comment_id, 'user_id' => $this->user_id, 'comment_type' => $this->comment_type, 'status' => $this->status, 'created_at' => $this->created_at]);
     $query->andFilterWhere(['like', 'comment_content', $this->comment_content]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * Lists all SongComment models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => SongComment::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }