diff --git a/src/SleepingOwl/WithJoin/WithJoinEloquentBuilder.php b/src/SleepingOwl/WithJoin/WithJoinEloquentBuilder.php index 15728ed..4a406e8 100644 --- a/src/SleepingOwl/WithJoin/WithJoinEloquentBuilder.php +++ b/src/SleepingOwl/WithJoin/WithJoinEloquentBuilder.php @@ -89,7 +89,7 @@ protected function addJoinToQuery($joinTableAlias, $currentTableAlias, Relation ]); $joinLeftCondition = implode('.', [ $joinTableAlias, - $relation->getOtherKey() + $relation->getOwnerKey() ]); $joinRightCondition = implode('.', [ $currentTableAlias,