Skip to content

Commit 56126cf

Browse files
KKSzymanowskichrishardinge
authored andcommitted
[5.4] Add ability to remove a global scope with another global scope (laravel#19657)
* Fix laravel#19282 * Fix import order * Update Builder.php
1 parent 887045b commit 56126cf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Illuminate/Database/Eloquent/Builder.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,11 @@ public function applyScopes()
889889

890890
$builder = clone $this;
891891

892-
foreach ($this->scopes as $scope) {
892+
foreach ($this->scopes as $identifier => $scope) {
893+
if (! isset($builder->scopes[$identifier])) {
894+
continue;
895+
}
896+
893897
$builder->callScope(function (Builder $builder) use ($scope) {
894898
// If the scope is a Closure we will just go ahead and call the scope with the
895899
// builder instance. The "callScope" method will properly group the clauses

0 commit comments

Comments
 (0)