<?php


namespace app\model;

use DateTimeInterface;
use support\Model;

class MarketCustomerLogs extends Model
{
    protected $table = 'market_customer_logs';

    protected $dateFormat = 'U';

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

    public function custom()
    {
        return $this->belongsTo(MarketCustomer::class, 'market_customer_id');
    }

    public function beforeMan()
    {
        return $this->belongsTo(Consultant::class, 'before_consultant_id');
    }

    public function currentMan()
    {
        return $this->belongsTo(Consultant::class, 'consultant_id');
    }

    public function opBackPerson()
    {
        return $this->belongsTo(SysUser::class, 'change_user_id');
    }

    public function opFrontPerson()
    {
        return $this->belongsTo(Consultant::class, 'change_consultant_id');
    }

    public function beforeDept(){
        return $this->belongsTo(SysDept::class, 'before_dept_id');
    }

    public function currentDept(){
        return $this->belongsTo(SysDept::class, 'dept_id');
    }
}