BroadcastAssistant.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\model\store\broadcast;
  12. use app\common\model\BaseModel;
  13. use app\common\model\system\merchant\Merchant;
  14. class BroadcastAssistant extends BaseModel
  15. {
  16. public static function tablePk(): ?string
  17. {
  18. return 'assistant_id';
  19. }
  20. public static function tableName(): string
  21. {
  22. return 'broadcast_assistant';
  23. }
  24. public function merchant()
  25. {
  26. return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
  27. }
  28. public function searchMerIdAttr($query,$value)
  29. {
  30. $query->where('mer_id',$value);
  31. }
  32. public function searchUsernameAttr($query,$value)
  33. {
  34. $query->whereLike('username',"%{$value}%");
  35. }
  36. public function searchNicknameAttr($query,$value)
  37. {
  38. $query->whereLike('nickname',"%{$value}%");
  39. }
  40. public function searchAssistantIdsAttr($query,$value)
  41. {
  42. $query->whereIn('assistant_id', $value);
  43. }
  44. public function searchAssistantIdAttr($query,$value)
  45. {
  46. $query->where('assistant_id',$value);
  47. }
  48. }