1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?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',
- 'quota'
- ];
-
- 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 schedules() {
- return $this->hasMany(Schedule::class);
- }
-
- public function getExtraCreditsAttribute() {
- return calcExtraCredits($this->credits, $this->student_count);
- }
- }
|