PageCategory.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\model\diy;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. use think\Model;
  15. class PageCategory extends BaseModel
  16. {
  17. use ModelTrait;
  18. /**
  19. * 数据表主键
  20. * @var string
  21. */
  22. protected $pk = 'id';
  23. /**
  24. * 模型名称
  25. * @var string
  26. */
  27. protected $name = 'page_category';
  28. /**
  29. * 父类搜索器
  30. * @param Model $query
  31. * @param $value
  32. */
  33. public function searchPidAttr($query, $value)
  34. {
  35. if ($value !== '') {
  36. if (is_array($value)) {
  37. $query->whereIn('pid', $value);
  38. } else {
  39. $query->where('pid', $value);
  40. }
  41. }
  42. }
  43. /**
  44. * 是否使用搜索器
  45. * @param Model $query
  46. * @param $value
  47. */
  48. public function searchStatusAttr($query, $value)
  49. {
  50. if ($value != '') $query->where('status', $value);
  51. }
  52. }