CollegeCourses.php 713 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class CollegeCourses extends Model
  6. {
  7. protected $table = 'college_courses';
  8. protected $primaryKey = 'courses_id';
  9. protected $dateFormat = 'U';
  10. public const CREATED_AT = 'courses_addTime';
  11. public const UPDATED_AT = 'courses_updateTime';
  12. public function serializeDate(DateTimeInterface $date)
  13. {
  14. return $date->format('Y-m-d H:i:s');
  15. }
  16. public function category()
  17. {
  18. return $this->hasOne(SysCategory::class, 'category_id', 'courses_category_id');
  19. }
  20. public function teacher()
  21. {
  22. return $this->hasOne(CollegeTeacher::class, 'teacher_id', 'courses_teacher_id');
  23. }
  24. }