From e48f5d7fdaef1967dc863d91ed2a002ff197c993 Mon Sep 17 00:00:00 2001 From: xavadu Date: Wed, 29 Apr 2020 20:22:36 +0200 Subject: [PATCH] Real random table alias string #106 --- src/EloquentJoinBuilder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EloquentJoinBuilder.php b/src/EloquentJoinBuilder.php index e2e39c1..1251069 100644 --- a/src/EloquentJoinBuilder.php +++ b/src/EloquentJoinBuilder.php @@ -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 @@ -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);