ClientBrowse.php 1012 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class ClientBrowse extends Model
  6. {
  7. protected $table = 'client_browse';
  8. protected $primaryKey = 'client_browse_id';
  9. protected $dateFormat = 'U';
  10. const CREATED_AT = 'client_browse_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_client_browse_member_id');
  26. }
  27. /**
  28. * @Desc 关联商品
  29. * @Author Gorden
  30. * @Date 2024/3/30 13:08
  31. *
  32. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  33. */
  34. public function goods()
  35. {
  36. return $this->hasOne(Goods::class, 'goods_id', 'join_client_browse_goods_id');
  37. }
  38. }