staudenmeir / belongs-to-through

Laravel Eloquent BelongsToThrough relationships
MIT License
1.15k stars 88 forks source link

ID of result is the ID of the intermediate table instead #54

Closed Skintillion closed 3 years ago

Skintillion commented 3 years ago

Meeting has many Question, which has many Answer

public function meeting() {
    return $this->hasOneThrough('Meeting','Question','id','id','question_id','meeting_id');
}

or

public function meeting() {
    return $this->belongsToThrough('Meeting','Question');
}

in both instances, the result Meeting model will have the ID of the intermediate Question model.

Laravel 6 and I installed your plugin ^2.5

staudenmeir commented 3 years ago

Can you log the executed queries when loading the BelongsToThrough relationship?