<?php

namespace app\model;

use support\Model;

class FarmPlot extends Model
{
    protected $table = 'farm_plot';

    protected $primaryKey = 'farm_plot_id';

    protected $keyType = 'string';

    protected $dateFormat = 'U';

    public const CREATED_AT = 'farm_plot_addtimes';

    public const UPDATED_AT = null;


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

    public function dept()
    {
        return $this->hasOne(SysDept::class, 'dept_id', 'join_farm_plot_dept_id');
    }

    public function user()
    {
        return $this->hasOne(SysUser::class, 'user_id', 'join_farm_plot_user_id');
    }

    public function member()
    {
        return $this->hasOne(Member::class, 'member_id', 'join_farm_plot_member_id');
    }

    public function memberInfo()
    {
        return $this->hasOne(MemberInfo::class, 'join_info_member_id', 'join_farm_plot_member_id');
    }

    public function memberCert()
    {
        return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_farm_plot_member_id');
    }
}