id); } public function getTrueView() { return $this->getArticle() ? $this->getArticle()->getTrueView() : 0; } public function getComment() { return $this->getArticle() ? $this->getArticle()->comment : 0; } public function search($q) { $query = self::find()->where($q)->andWhere(['status' => 1]); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => [ 'defaultOrder' => [ 'published_at' => SORT_DESC, ] ] ]); return $dataProvider; } }