Member.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class Member extends Model
  6. {
  7. protected $table = 'member';
  8. protected $primaryKey = 'member_id';
  9. protected $keyType = 'string';
  10. protected $dateFormat = 'U';
  11. const CREATED_AT = 'member_addtimes';
  12. const UPDATED_AT = null;
  13. public function serializeDate(DateTimeInterface $date)
  14. {
  15. return $date->format('Y-m-d H:i:s');
  16. }
  17. /**
  18. * @Desc 关联member cert
  19. * @Author Gorden
  20. * @Date 2024/3/25 13:57
  21. *
  22. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  23. */
  24. public function cert()
  25. {
  26. return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'member_id');
  27. }
  28. /**
  29. * @Desc 关联member info
  30. * @Author Gorden
  31. * @Date 2024/3/25 13:56
  32. *
  33. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  34. */
  35. public function info()
  36. {
  37. return $this->hasOne(MemberInfo::class, 'join_info_member_id', 'member_id');
  38. }
  39. public function account()
  40. {
  41. return $this->hasMany(MemberAccount::class, 'join_account_member_id', 'member_id');
  42. }
  43. }