<?php

namespace common\models\query;

use common\enums\StatusEnum;
use common\models\Goods;

/**
 * This is the ActiveQuery class for [[\common\models\Goods]].
 *
 * @see \common\models\Goods
 */
class CatQuery extends \yii\db\ActiveQuery
{
    public function active()
    {
        return $this->andWhere(['status' => StatusEnum::STATUS_ON, 'is_del' => StatusEnum::STATUS_OFF]);
    }


    public function notDel()
    {
        return $this->andWhere(['is_del' => StatusEnum::STATUS_OFF]);
    }

    public function hot()
    {
        return $this->andWhere(['is_hot' => StatusEnum::STATUS_ON])->active();
    }

    /**
     * @inheritdoc
     * @return \common\models\Goods[]|array
     */
    public function all($db = null)
    {
        return parent::all($db);
    }

    /**
     * @inheritdoc
     * @return \common\models\Goods|array|null
     */
    public function one($db = null)
    {
        return parent::one($db);
    }
}
