Skip to content

Commit

Permalink
fix for previous versions
Browse files Browse the repository at this point in the history
  • Loading branch information
fico7489 committed Mar 6, 2019
1 parent 8ec93df commit b9cf8cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/EloquentJoinBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b9cf8cf

Please sign in to comment.