Level 6
Just make a seperate function for each relation and add the fieldnames:
in A-Model:
public function foo()
{
return $this->belongsTo(B-Model::class, 'id', 'foo_id');
}
public function bar()
{
return $this->belongsTo(B-Model::class, 'id', 'bar_id');
}
In B-Model:
public function foo()
{
return $this->hasMany(A-Model::class, 'foo_id', 'id');
}
public function bar()
{
return $this->hasMany(A-Model::class, 'bar_id', 'id');
}