You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
661 B
30 lines
661 B
7 years ago
|
<?php
|
||
|
|
||
|
namespace common\modules\banners\entities\queries;
|
||
|
|
||
|
use common\modules\banners\entities\Banner;
|
||
|
use yii\helpers\Url;
|
||
|
use yii\db\ActiveQuery;
|
||
|
|
||
|
class BannerQuery extends ActiveQuery
|
||
|
{
|
||
|
/**
|
||
|
* @param null $alias
|
||
|
* @return $this
|
||
|
*/
|
||
|
public function active()
|
||
|
{
|
||
|
return $this->andWhere(['active' => Banner::STATUS_ACTIVE]);
|
||
|
}
|
||
|
|
||
|
public function showTime()
|
||
|
{
|
||
|
return $this->andWhere(['<', 'start_at', time()])->andWhere(['>', 'end_at', time()]);
|
||
|
}
|
||
|
|
||
|
/*public function excludeFree()
|
||
|
{
|
||
|
$current = Url::current([]);
|
||
|
return $this->andWhere(['not rlike', 'exclude_urls', '^'.$current.'$']);
|
||
|
}*/
|
||
|
}
|