class Company extends Model
{
public function departments()
{
return $this->hasMany('App\Department');
}
public function results()
{
return $this->hasMany('App\Result');
}
}
class Department extends Model
{
public function cities()
{
return $this->belongsToMany('App\City');
}
public function company()
{
return $this->belongsTo('App\Company');
}
}
class City extends Model
{
public function departments()
{
return $this->belongsToMany('App\Department');
}
}
class Result extends Model
{
public function company()
{
return $this->belongsTo('App\Company');
}
public function city()
{
return $this->belongsTo('App\City');
}
}