GoodsEvaluate.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class GoodsEvaluate extends Model
  6. {
  7. protected $table = 'goods_evaluate';
  8. protected $primaryKey = 'goods_evaluate_id';
  9. protected $dateFormat = 'U';
  10. const CREATED_AT = 'goods_evaluate_addtimes';
  11. const UPDATED_AT = null;
  12. public function serializeDate(DateTimeInterface $date)
  13. {
  14. return $date->format('Y-m-d H:i:s');
  15. }
  16. /**
  17. * @Desc 关联会员
  18. * @Author Gorden
  19. * @Date 2024/3/30 13:08
  20. *
  21. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  22. */
  23. public function member()
  24. {
  25. return $this->hasOne(Member::class, 'member_id', 'join_evaluate_member_id');
  26. }
  27. /**
  28. * 关联Cert
  29. */
  30. public function cert()
  31. {
  32. return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_evaluate_member_id');
  33. }
  34. public function info()
  35. {
  36. return $this->hasOne(MemberInfo::class, 'join_info_member_id', 'join_evaluate_member_id');
  37. }
  38. /**
  39. * @Desc 关联商品
  40. * @Author Gorden
  41. * @Date 2024/3/30 13:08
  42. *
  43. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  44. */
  45. public function goods()
  46. {
  47. return $this->hasMany(Goods::class, 'goods_id', 'join_evaluate_goods_id');
  48. }
  49. public function good()
  50. {
  51. return $this->hasOne(Goods::class, 'goods_id', 'join_evaluate_goods_id');
  52. }
  53. /**
  54. * 关联订单
  55. */
  56. public function order()
  57. {
  58. return $this->hasOne(Order::class, 'order_id', 'join_evaluate_order_id');
  59. }
  60. }