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);