Category.php 772 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\common\model\supplier;
  3. use app\common\model\BaseModel;
  4. /**
  5. * 广告分类模型
  6. */
  7. class Category extends BaseModel
  8. {
  9. protected $name = 'supplier_category';
  10. protected $pk = 'category_id';
  11. /**
  12. * 所有分类
  13. * @return \think\Collection
  14. * @throws \think\db\exception\DataNotFoundException
  15. * @throws \think\db\exception\DbException
  16. * @throws \think\db\exception\ModelNotFoundException
  17. */
  18. public static function getALL()
  19. {
  20. $model = new static;
  21. return $model->order(['create_time' => 'asc'])->select();
  22. }
  23. /**
  24. * 详情
  25. */
  26. public static function detail($category_id)
  27. {
  28. return (new static())->find($category_id);
  29. }
  30. }