src/GeneratorCollection.php
public function last(callable $callback = null, $default = null)
    {
        $collection = $callback ? $this->filter($callback) : $this;

        foreach ($collection->all() as $key => $value) {
            // Nothing needed here
        }

        return isset($value) ? $value : $default;
    }
public function last(callable $callback = null, $default = null)
    {
        $collection = $callback ? $this->filter($callback) : $this;

        foreach ($collection->all() as $key => $value) {
            // Nothing needed here
        }

        return isset($value) ? $value : $default;
    }
public function last ( callable $ callback = null , $ default = null ) { $ collection = $ callback ? $ this -> filter ( $ callback ) : $ this ; foreach ( $ collection -> all ( ) as $ key => $ value ) { // Nothing needed here } return isset ( $ value ) ? $ value : $ default ; }
Return the last element

@param  callable|null $callback if a callback is provided, we will filter the collection using that callback
@param  mixed $defualt
@return mixed
Return the last element