From b9cf8cfc89da246a46bbabe021ed0d9bb992d1cd Mon Sep 17 00:00:00 2001 From: Filip Horvat Date: Wed, 6 Mar 2019 10:35:01 +0100 Subject: [PATCH] fix for previous versions --- src/EloquentJoinBuilder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EloquentJoinBuilder.php b/src/EloquentJoinBuilder.php index 8935be6..aa84f37 100644 --- a/src/EloquentJoinBuilder.php +++ b/src/EloquentJoinBuilder.php @@ -190,9 +190,9 @@ private function performJoin($relations, $leftJoin = null) if (!in_array($relationAccumulatedString, $this->joinedTables)) { $joinQuery = $relatedTable.($this->useTableAlias ? ' as '.$relatedTableAlias : ''); if ($relatedRelation instanceof BelongsToJoin) { - $relatedKey = $relatedRelation->getQualifiedForeignKeyName(); + $relatedKey = ((float) \App::version() < 5.8) ? $relatedRelation->getQualifiedForeignKey() : $relatedRelation->getQualifiedForeignKeyName(); $relatedKey = last(explode('.', $relatedKey)); - $ownerKey = $relatedRelation->getOwnerKeyName(); + $ownerKey = ((float) \App::version() < 5.8) ? $relatedRelation->getOwnerKey() : $relatedRelation->getOwnerKeyName(); $this->$joinMethod($joinQuery, function ($join) use ($relatedRelation, $relatedTableAlias, $relatedKey, $currentTableAlias, $ownerKey) { $join->on($relatedTableAlias.'.'.$ownerKey, '=', $currentTableAlias.'.'.$relatedKey);