12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
-
- namespace App;
-
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
-
- class Section extends Model
- {
-
- protected $fillable = [
- 'course_id',
- 'semester_code',
- 'code',
- 'credits',
- 'student_count',
- 'syllabus'
- ];
-
- public $timestamps = false;
-
- public function semester() {
- return $this->belongsTo(Semester::class);
- }
-
- public function course() {
- return $this->belongsTo(Course::class);
- }
-
- public function professors() {
- return $this->belongsToMany(Professor::class);
- }
-
- public function getExtraCreditsAttribute() {
- return calcExtraCredits($this->credits, $this->student_count);
- }
- }
|