1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class Championship extends Model
- {
- protected $fillable = ['title', 'from_date', 'to_date', 'month', 'year', 'expert', 'competence', 'city', 'location', 'group', 'status'];
- public function expert()
- {
- return $this->hasOne(User::class, 'id', 'expert');
- }
- public function competence()
- {
- return $this->hasOne(Competence::class, 'number', 'competence');
- }
- public function competences()
- {
- return $this->hasOne(Competence::class, 'number', 'competence');
- }
- public function month()
- {
- return $this->hasOne(Month::class, 'id', 'month');
- }
- public function months()
- {
- return $this->hasOne(Month::class, 'id', 'month');
- }
- public function modules()
- {
- return $this->hasMany(Module::class, 'championship', 'id');
- }
- public function members()
- {
- return $this->hasMany(Member::class, 'championship', 'id');
- }
- public function experts()
- {
- return $this->hasMany(Expert::class, 'champ_id', 'id');
- }
- public function cities()
- {
- return $this->hasOne(City::class, 'id', 'city');
- }
- }
|