WellnessRecord.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class WellnessRecord extends Model
  6. {
  7. protected $table = 'wellness_record';
  8. protected $primaryKey = 'wellness_record_id';
  9. protected $dateFormat = 'U';
  10. const CREATED_AT = 'wellness_record_addtimes';
  11. const UPDATED_AT = null;
  12. protected 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/29 16:10
  20. *
  21. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  22. */
  23. public function member()
  24. {
  25. return $this->hasOne(Member::class, 'member_id', 'join_wellness_record_member_id');
  26. }
  27. /**
  28. * @Desc 关联用户身份
  29. * @Author Gorden
  30. * @Date 2024/3/29 16:10
  31. *
  32. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  33. */
  34. public function cert(){
  35. return $this->hasOne(MemberCert::class,'join_cert_member_id','join_wellness_record_member_id');
  36. }
  37. }