'json', 'file_ids' => 'json']; protected $appends = ['publicize', 'files']; public function getFilesAttribute($value) { if (empty($this->file_ids)) return []; return Upload::whereIn('id', $this->file_ids)->get(); } public function getPublicizeAttribute($value) { if (empty($this->publicize_ids)) return []; return Upload::whereIn('id', $this->publicize_ids)->get(); } public function course() { return $this->hasOne(Course::class, 'id', 'course_id'); } public function coursePeriod() { return $this->hasOne(CoursePeriod::class, 'id', 'course_period_id'); } public function courseSetting() { return $this->hasOne(CourseSetting::class, 'id', 'course_setting_id'); } public function teacher() { return $this->hasOne(Teacher::class, 'id', 'teacher_id'); } public function courseKeeps() { return $this->hasMany(CourseKeep::class, 'course_content_id', 'id'); } public function courseSigns() { return $this->hasMany(CourseSign::class, 'course_id', 'course_id'); } public function courseContentEvaluation() { return $this->hasOne(CourseContentEvaluation::class, 'course_content_id', 'id'); } }