Açıklama Yok

Semester.php 718B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Semester extends Model
  5. {
  6. public $primaryKey = 'code';
  7. public $incrementing = false;
  8. public $timestamps = false;
  9. protected $keyType = 'string';
  10. public function courses() {
  11. return $this->belongsToMany(Course::class, 'sections');
  12. }
  13. public function sections() {
  14. return $this->hasMany(Section::class);
  15. }
  16. public function professors() {
  17. return $this->belongsToMany(Professor::class)->withPivot('admin_load', 'investigative_load');
  18. }
  19. public function getIsFutureAttribute() {
  20. return Semester::orderBy('code', 'desc')->take(6)->get()->contains('code', $this->code);
  21. }
  22. }