<?php

namespace app\model;

use DateTimeInterface;
use support\Model;

class Asset extends Model
{
    protected $table = 'asset';

    protected $primaryKey = 'asset_id';

    protected $keyType = 'string';

    protected $dateFormat = 'U';

    const CREATED_AT = 'asset_addtimes';

    const UPDATED_AT = null;

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

    public function category()
    {
        return $this->hasOne(SysCategory::class, 'category_id', 'join_asset_category_id');
    }
}