From 456c9ba62658f2d969e259d57e354bfa26d46164 Mon Sep 17 00:00:00 2001 From: Filip Horvat Date: Wed, 28 Aug 2019 09:38:48 +0200 Subject: [PATCH] fix for useTableAlias = true --- src/EloquentJoinBuilder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EloquentJoinBuilder.php b/src/EloquentJoinBuilder.php index aa84f37..c6dc2fc 100644 --- a/src/EloquentJoinBuilder.php +++ b/src/EloquentJoinBuilder.php @@ -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 @@ -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);