ProductGroupUser.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace app\common\model\store\product;
  3. use app\common\model\BaseModel;
  4. use app\common\model\store\order\StoreOrder;
  5. class ProductGroupUser extends BaseModel
  6. {
  7. /**
  8. * TODO
  9. * @return string
  10. * @author Qinii
  11. * @day 1/7/21
  12. */
  13. public static function tablePk(): string
  14. {
  15. return '';
  16. }
  17. /**
  18. * TODO
  19. * @return string
  20. * @author Qinii
  21. * @day 1/7/21
  22. */
  23. public static function tableName(): string
  24. {
  25. return 'store_product_group_user';
  26. }
  27. public function orderInfo()
  28. {
  29. return $this->hasOne(StoreOrder::class,'order_id','order_id');
  30. }
  31. public function groupBuying()
  32. {
  33. return $this->hasOne(ProductGroupBuying::class,'group_buying_id','group_buying_id');
  34. }
  35. // public function getAvatarAttr($value)
  36. // {
  37. // return $value ? $value : '/static/f.png';
  38. // }
  39. public function searchProductGroupIdAttr($query,$value)
  40. {
  41. $query->where('product_group_id',$value);
  42. }
  43. public function searchGroupBuyingIdAttr($query,$value)
  44. {
  45. $query->where('group_buying_id',$value);
  46. }
  47. public function searchUidAttr($query,$value)
  48. {
  49. $query->where('uid',$value);
  50. }
  51. public function searchIsDelAttr($query,$value)
  52. {
  53. $query->where('is_del',$value);
  54. }
  55. }