<?php

namespace app\model;

use DateTimeInterface;
use support\Model;

class Adv extends Model
{
    protected $table = 'adv';

    protected $primaryKey = 'adv_id';

    protected $dateFormat = 'U';

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