diff --git a/src/Illuminate/Database/Eloquent/Builder.php b/src/Illuminate/Database/Eloquent/Builder.php index 768883abd25a..79115c1f8f57 100755 --- a/src/Illuminate/Database/Eloquent/Builder.php +++ b/src/Illuminate/Database/Eloquent/Builder.php @@ -1142,6 +1142,28 @@ protected function parseNestedWith($name, $results) return $results; } + /** + * Add the given scopes to the current builder instance. + * + * @param array $scopes + * @return mixed + */ + public function scopes(array $scopes) + { + $builder = $this; + + foreach ($scopes as $scope => $parameters) { + if (is_int($scope)) { + $scope = $parameters; + $parameters = []; + } + + $builder = $builder->callScope('scope'.ucfirst($scope), (array) $parameters); + } + + return $builder; + } + /** * Apply the given scope on the current builder instance. *