common/models/query/ArticleQuery.php
<?php
/*
* This file is part of the HomeFinanceV2 project.
*
* (c) Rafalsky.com <http://github.com/Rafalsky/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace common\models\query;
use common\models\Article;
use yii\db\ActiveQuery;
class ArticleQuery extends ActiveQuery
{
public function published()
{
$this->andWhere(['status' => Article::STATUS_PUBLISHED]);
$this->andWhere(['<', '{{%article}}.published_at', time()]);
return $this;
}
}