diff --git a/src/Illuminate/Database/Eloquent/Builder.php b/src/Illuminate/Database/Eloquent/Builder.php index a28db3fc99c9..2de598b15c77 100755 --- a/src/Illuminate/Database/Eloquent/Builder.php +++ b/src/Illuminate/Database/Eloquent/Builder.php @@ -1094,7 +1094,7 @@ protected function parseWithRelations(array $relations) [$name, $constraints] = Str::contains($name, ':') ? $this->createSelectWithConstraint($name) - : [$name, function () { + : [$name, static function () { // }]; } @@ -1118,7 +1118,7 @@ protected function parseWithRelations(array $relations) */ protected function createSelectWithConstraint($name) { - return [explode(':', $name)[0], function ($query) use ($name) { + return [explode(':', $name)[0], static function ($query) use ($name) { $query->select(explode(',', explode(':', $name)[1])); }]; } @@ -1141,7 +1141,7 @@ protected function addNestedWiths($name, $results) $progress[] = $segment; if (! isset($results[$last = implode('.', $progress)])) { - $results[$last] = function () { + $results[$last] = static function () { // }; }