<?php

namespace app\model;

use DateTimeInterface;
use support\Model;

class CollegeCourses extends Model
{
    protected $table = 'college_courses';

    protected $primaryKey = 'courses_id';

    protected $dateFormat = 'U';

    public const CREATED_AT = 'courses_addTime';

    public const UPDATED_AT = 'courses_updateTime';

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

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

    public function teacher()
    {
        return $this->hasOne(CollegeTeacher::class, 'teacher_id', 'courses_teacher_id');
    }
}