Skip to content

Commit

Permalink
fix(laravel): eloquent BelongsToMany relation (#6862)
Browse files Browse the repository at this point in the history
  • Loading branch information
amermchaudhary authored Dec 19, 2024
1 parent f15a338 commit 3a69462
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Laravel/Eloquent/State/LinksHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ private function buildQuery(Builder $builder, Link $link, mixed $identifier): Bu
$relation_query = $relation->{$from}();

return $builder->getModel()->join(
$relation_query->getTable(), $relation->{$from}()->getQualifiedForeignPivotKeyName(), $builder->getModel()->getQualifiedKeyName())
$relation_query->getTable(), $relation->{$from}()->getQualifiedRelatedPivotKeyName(), $builder->getModel()->getQualifiedKeyName())
->where($relation->{$from}()->getQualifiedForeignPivotKeyName(),
$identifier);
$identifier)
->select($builder->getModel()->getTable().'.*');
}

return $builder->getModel()->where($relation->{$from}()->getQualifiedForeignKeyName(), $identifier);
Expand Down

0 comments on commit 3a69462

Please sign in to comment.