<?php

namespace app\model;

use DateTimeInterface;
use support\Model;

class CardMain extends Model
{
    protected $table = 'card_main';

    protected $primaryKey = 'card_main_id';

    protected $dateFormat = 'U';

    const CREATED_AT = 'card_main_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_card_main_category_id')->select('category_id','category_name');
    }
}