UserLabelRelation.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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\user;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. use think\Model;
  15. /**
  16. * Class UserLabelRelation
  17. * @package app\model\user
  18. */
  19. class UserLabelRelation extends BaseModel
  20. {
  21. use ModelTrait;
  22. /**
  23. * 模型名称
  24. * @var string
  25. */
  26. protected $name = 'user_label_relation';
  27. /**
  28. * @return \think\model\relation\HasOne
  29. */
  30. public function label()
  31. {
  32. return $this->hasOne(UserLabel::class, 'id', 'label_id')->bind([
  33. 'label_name' => 'label_name'
  34. ]);
  35. }
  36. /**
  37. * uid搜索器
  38. * @param Model $query
  39. * @param $value
  40. */
  41. public function searchUidAttr($query, $value)
  42. {
  43. $query->whereIn('uid', $value);
  44. }
  45. }