<?php

namespace app\model;

use support\Model;

class FarmPlotRunning extends Model
{
    protected $table = 'farm_plot_running';

    protected $primaryKey = 'farm_plot_running_id';

    protected $dateFormat = 'U';

    public const CREATED_AT = 'farm_plot_running_addtimes';

    public const UPDATED_AT = null;


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

    public function plot()
    {
        return $this->hasOne(FarmPlot::class, 'farm_plot_id', 'join_running_farm_plot_id');
    }

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

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

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