<?php

namespace app\model;

use DateTimeInterface;
use support\Model;

class WellnessRecord extends Model
{
    protected $table = 'wellness_record';

    protected $primaryKey = 'wellness_record_id';

    protected $dateFormat = 'U';

    const CREATED_AT = 'wellness_record_addtimes';

    const UPDATED_AT = null;

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    /**
     * @Desc 关联用户
     * @Author Gorden
     * @Date 2024/3/29 16:10
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function member()
    {
        return $this->hasOne(Member::class, 'member_id', 'join_wellness_record_member_id');
    }

    /**
     * @Desc 关联用户身份
     * @Author Gorden
     * @Date 2024/3/29 16:10
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function cert(){
        return $this->hasOne(MemberCert::class,'join_cert_member_id','join_wellness_record_member_id');
    }
}