<?php

namespace app\model;

use DateTimeInterface;
use support\Model;

class SysLog extends Model
{
    protected $table = 'sys_log';

    protected $primaryKey = 'log_id';

    protected $dateFormat = 'U';

    const CREATED_AT = 'log_create_time';

    const UPDATED_AT = null;

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

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