CategoryQuery.php 824 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: NODELOG
  5. * Date: 16/3/17
  6. * Time: 上午10:19
  7. */
  8. namespace common\models\query;
  9. use common\enums\StatusEnum;
  10. use common\models\Article;
  11. use yii\db\ActiveQuery;
  12. class CategoryQuery extends ActiveQuery
  13. {
  14. /**
  15. * @param null $db
  16. * @return array|Article[]
  17. */
  18. public function all($db = null)
  19. {
  20. return parent::all($db); // TODO: Change the autogenerated stub
  21. }
  22. /**
  23. * @param null $db
  24. * @return array|null|Article
  25. */
  26. public function one($db = null)
  27. {
  28. return parent::one($db); // TODO: Change the autogenerated stub
  29. }
  30. /**
  31. * 审核通过的
  32. */
  33. public function active()
  34. {
  35. return $this->andWhere(['status' => StatusEnum::STATUS_ON, 'is_del' => StatusEnum::STATUS_OFF]);
  36. }
  37. }