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.

PageLink.php 918B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\model\diy;
  3. use crmeb\basic\BaseModel;
  4. use crmeb\traits\ModelTrait;
  5. use think\Model;
  6. class PageLink extends BaseModel
  7. {
  8. use ModelTrait;
  9. /**
  10. * 数据表主键
  11. * @var string
  12. */
  13. protected $pk = 'id';
  14. /**
  15. * 模型名称
  16. * @var string
  17. */
  18. protected $name = 'page_link';
  19. /**
  20. * 分类搜索器
  21. * @param Model $query
  22. * @param $value
  23. */
  24. public function searchCateIdAttr($query, $value)
  25. {
  26. if ($value) {
  27. if (is_array($value)) {
  28. $query->whereIn('cate_id', $value);
  29. } else {
  30. $query->where('cate_id', $value);
  31. }
  32. }
  33. }
  34. /**
  35. * 是否使用搜索器
  36. * @param Model $query
  37. * @param $value
  38. */
  39. public function searchStatusAttr($query, $value)
  40. {
  41. if ($value != '') $query->where('status', $value);
  42. }
  43. }