Skip to content

Commit

Permalink
fix for useTableAlias = true
Browse files Browse the repository at this point in the history
  • Loading branch information
fico7489 committed Aug 28, 2019
1 parent 24eda0a commit 456c9ba
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 @@ -24,7 +24,7 @@ class EloquentJoinBuilder extends Builder
const AGGREGATE_MIN = 'MIN';
const AGGREGATE_COUNT = 'COUNT';

//use table alias for join (real table name or uniqid())
//use table alias for join (real table name or sha1)
private $useTableAlias = false;

//appendRelationsCount
Expand Down Expand Up @@ -177,7 +177,7 @@ private function performJoin($relations, $leftJoin = null)
$relatedModel = $relatedRelation->getRelated();
$relatedPrimaryKey = $relatedModel->getKeyName();
$relatedTable = $relatedModel->getTable();
$relatedTableAlias = $this->useTableAlias ? uniqid() : $relatedTable;
$relatedTableAlias = $this->useTableAlias ? sha1($relatedTable) : $relatedTable;

$relationsAccumulated[] = $relatedTableAlias;
$relationAccumulatedString = implode('_', $relationsAccumulated);
Expand Down

0 comments on commit 456c9ba

Please sign in to comment.