andWhere([ ($alias ? $alias . '.' : '') . 'status' => BlogPost::STATUS_ACTIVE, ]); } public function byType($type) { return $this->andWhere(['type_id' => $type]); } public function last() { return $this->orderBy(['published_at' => SORT_DESC]); } public function popular() { return $this->orderBy(['views' => SORT_DESC]); } }