Skip to content

Commit 4175e66

Browse files
committed
Fixed fromRaw
1 parent e694768 commit 4175e66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Mixins/JoinRelationship.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function joinRelationship(): Closure
110110
// 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.
111111
$fromClause = $this->getQuery()->from;
112112
$mainTableOrAlias = $this->getModel()->getTable();
113-
if ($fromClause && preg_match('/^.+\s+as\s+["\'\`]?(.+?)["\'\`]?$/i', $fromClause, $matches)) {
113+
if ($fromClause && is_string($fromClause) && preg_match('/^.+\s+as\s+["\'\`]?(.+?)["\'\`]?$/i', $fromClause, $matches)) {
114114
// Register the alias for the main model so joins use it
115115
$mainTableOrAlias = $matches[1];
116116
StaticCache::setTableAliasForModel($this->getModel(), $mainTableOrAlias);

0 commit comments

Comments
 (0)