diff --git a/src/Concerns/EnumerableMethods.php b/src/Concerns/EnumerableMethods.php index 0cf94c8c..01633413 100644 --- a/src/Concerns/EnumerableMethods.php +++ b/src/Concerns/EnumerableMethods.php @@ -65,6 +65,19 @@ public function first(callable|null $callback = null, $default = null) return $this->items->first($callback, $default); } + /** + * @template TLastDefault + * + * @param null| (callable(TValue,TKey): bool) $callback + * @param TLastDefault|(\Closure(): TLastDefault) $default + * + * @return TValue|TLastDefault + */ + public function last(callable|null $callback = null, $default = null) + { + return $this->items->last($callback, $default); + } + /** * @param callable(TValue, TKey): mixed $callback *