Championship.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Championship extends Model
  5. {
  6. protected $fillable = ['title', 'from_date', 'to_date', 'month', 'year', 'expert', 'competence', 'city', 'location', 'group', 'status'];
  7. public function expert()
  8. {
  9. return $this->hasOne(User::class, 'id', 'expert');
  10. }
  11. public function competence()
  12. {
  13. return $this->hasOne(Competence::class, 'number', 'competence');
  14. }
  15. public function competences()
  16. {
  17. return $this->hasOne(Competence::class, 'number', 'competence');
  18. }
  19. public function month()
  20. {
  21. return $this->hasOne(Month::class, 'id', 'month');
  22. }
  23. public function months()
  24. {
  25. return $this->hasOne(Month::class, 'id', 'month');
  26. }
  27. public function modules()
  28. {
  29. return $this->hasMany(Module::class, 'championship', 'id');
  30. }
  31. public function members()
  32. {
  33. return $this->hasMany(Member::class, 'championship', 'id');
  34. }
  35. public function experts()
  36. {
  37. return $this->hasMany(Expert::class, 'champ_id', 'id');
  38. }
  39. public function cities()
  40. {
  41. return $this->hasOne(City::class, 'id', 'city');
  42. }
  43. }