Beispiel #1
0
 public function run()
 {
     if ($this->id == 0) {
         return;
     }
     $model = new BlogComments();
     $comments = BlogComments::find()->orderBy('date_gmt ' . $this->orderDirection)->where('post_id = :id', ['id' => $this->id])->all();
     return $this->render('comment', ['model' => $model, 'comments' => $comments, 'id' => $this->id]);
 }
 public function search($params)
 {
     $query = BlogCommentsModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'post_id' => $this->post_id, 'parent' => $this->parent, 'notify_reply' => $this->notify_reply, 'notify_comments' => $this->notify_comments, 'date' => $this->date, 'date_gmt' => $this->date_gmt]);
     $query->andFilterWhere(['like', 'comment', $this->comment])->andFilterWhere(['like', 'approved', $this->approved])->andFilterWhere(['like', 'author_name', $this->author_name])->andFilterWhere(['like', 'author_email', $this->author_email])->andFilterWhere(['like', 'author_url', $this->author_url])->andFilterWhere(['like', 'author_ip', $this->author_ip]);
     return $dataProvider;
 }