We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e694768 commit 4175e66Copy full SHA for 4175e66
src/Mixins/JoinRelationship.php
@@ -110,7 +110,7 @@ public function joinRelationship(): Closure
110
// Check if the main table has an alias (e.g., "posts as p") and set it as the main table or alias if it does.
111
$fromClause = $this->getQuery()->from;
112
$mainTableOrAlias = $this->getModel()->getTable();
113
- if ($fromClause && preg_match('/^.+\s+as\s+["\'\`]?(.+?)["\'\`]?$/i', $fromClause, $matches)) {
+ if ($fromClause && is_string($fromClause) && preg_match('/^.+\s+as\s+["\'\`]?(.+?)["\'\`]?$/i', $fromClause, $matches)) {
114
// Register the alias for the main model so joins use it
115
$mainTableOrAlias = $matches[1];
116
StaticCache::setTableAliasForModel($this->getModel(), $mainTableOrAlias);
0 commit comments