From a01e9edfadb140559d1bbf9999dda49148bfa5f7 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 13 Oct 2021 14:21:49 -0500 Subject: [PATCH] add alias method --- .../Collections/Traits/EnumeratesValues.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Illuminate/Collections/Traits/EnumeratesValues.php b/src/Illuminate/Collections/Traits/EnumeratesValues.php index 7896d6156378..941ce3a4b89a 100644 --- a/src/Illuminate/Collections/Traits/EnumeratesValues.php +++ b/src/Illuminate/Collections/Traits/EnumeratesValues.php @@ -772,6 +772,20 @@ class_basename(static::class), gettype($result) return $result; } + /** + * Reduce the collection to multiple aggregate values. + * + * @param callable $callback + * @param mixed ...$initial + * @return array + * + * @throws \UnexpectedValueException + */ + public function reduceSpread(callable $callback, ...$initial) + { + return $this->reduceMany($callback, ...$initial); + } + /** * Reduce an associative collection to a single value. *