123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace app\common\model;
- use think\Db;
- use think\Model;
- /**
- * 群组
- */
- class UniversityCourseModel extends Model
- {
- // 表名
- protected $name = 'university_course';
- // 开启自动写入时间戳字段
- protected $autoWriteTimestamp = false;
- // 定义时间戳字段名
- protected $createTime = false;
- protected $updateTime = false;
- protected $deleteTime = false;
- public function getImageAttr($value, $data)
- {
- return cdnurl($value);
- }
- public function getImagesAttr($value, $data)
- {
- $value = explode(',',$value);
- foreach ($value as &$v){
- $v = cdnurl($v);
- }
- return $value;
- }
- public function chapter()
- {
- return $this->hasMany(UniversityCourseChapterModel::class, 'course_id', 'id');
- }
- public function apply()
- {
- return $this->hasOne(UniversityCourseApplyModel::class, 'course_id', 'id');
- }
- }
|