src/Collection/Collection.php
public function last(callable $callback = null, $default = null)
    {
        if (is_null($callback)) {
            return count($this->items) > 0 ? end($this->items) : value($default);
        }

        return Arr::last($this->items, $callback, $default);
    }
public function last(callable $callback = null, $default = null)
    {
        if (is_null($callback)) {
            return count($this->items) > 0 ? end($this->items) : value($default);
        }

        return Arr::last($this->items, $callback, $default);
    }
Get the last item from the collection.

@param  callable|null $callback
@param  mixed         $default

@return mixed