GoodsEvaluate.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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->hasOne(Goods::class, 'goods_id', 'join_evaluate_goods_id');
  48. }
  49. /**
  50. * 关联订单
  51. */
  52. public function order()
  53. {
  54. return $this->hasOne(Order::class, 'order_id', 'join_evaluate_order_id');
  55. }
  56. }