Auxiliary.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 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\other;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. /**
  15. * 辅助表
  16. * Class Auxiliary
  17. * @package app\model\other
  18. */
  19. class Auxiliary extends BaseModel
  20. {
  21. use ModelTrait;
  22. /**
  23. * 表明
  24. * @var string
  25. */
  26. protected $name = 'auxiliary';
  27. protected $insert = ['add_time'];
  28. protected $autoWriteTimestamp = false;
  29. /**
  30. * 主键
  31. * @var string
  32. */
  33. protected $pk = 'id';
  34. /**类型搜索器
  35. * @param $query
  36. * @param $value
  37. */
  38. public function searchTypeAttr($query, $value)
  39. {
  40. $query->where('type', $value);
  41. }
  42. /**类型绑定id搜索器
  43. * @param $query
  44. * @param $value
  45. */
  46. public function searchBindingIdAttr($query, $value)
  47. {
  48. $query->where('binding_id', $value);
  49. }
  50. /**类型状态搜索器
  51. * @param $query
  52. * @param $value
  53. */
  54. public function searchStatusAttr($query, $value)
  55. {
  56. $query->whereIn('status', $value);
  57. }
  58. /**类型关联id搜索器
  59. * @param $query
  60. * @param $value
  61. */
  62. public function searchRelationIdAttr($query, $value)
  63. {
  64. $query->where('relation_id', $value);
  65. }
  66. }