Skip to content

Commit

Permalink
Merge pull request #107 from xavadu/master
Browse files Browse the repository at this point in the history
Real random table alias string (resolve #106)
  • Loading branch information
fico7489 authored Sep 5, 2020
2 parents c9a4bd0 + e48f5d7 commit a1dfe69
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 @@ -25,7 +25,7 @@ class EloquentJoinBuilder extends Builder
const AGGREGATE_MIN = 'MIN';
const AGGREGATE_COUNT = 'COUNT';

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

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

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

0 comments on commit a1dfe69

Please sign in to comment.