belongsTo(Semester::class); } public function course() { return $this->belongsTo(Course::class); } public function professors() { return $this->belongsToMany(Professor::class); } public function schedules() { return $this->hasMany(Schedule::class); } public function getExtraCreditsAttribute() { return calcExtraCredits($this->credits, $this->student_count); } }