From 745fd0bcf831810dfd97fa3a882cf9559f3543c1 Mon Sep 17 00:00:00 2001 From: Will Rowe Date: Thu, 27 Feb 2025 13:30:39 -0500 Subject: [PATCH] [13.x] Fix scope removal in nested where conditions (#54816) * Add tests * Remove any scopes removed in a nested where * Update tests to expect calls to `removedScopes` --- Eloquent/Builder.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Eloquent/Builder.php b/Eloquent/Builder.php index 3948debe2..456e9454c 100755 --- a/Eloquent/Builder.php +++ b/Eloquent/Builder.php @@ -326,6 +326,9 @@ public function where($column, $operator = null, $value = null, $boolean = 'and' $this->eagerLoad = array_merge($this->eagerLoad, $query->getEagerLoads()); + $this->withoutGlobalScopes( + $query->removedScopes() + ); $this->query->addNestedWhereQuery($query->getQuery(), $boolean); } else { $this->query->where(...func_get_args());