src/Collection.php
public function max($key = null)
    {
        $callback = $this->valueAccessor($key);

        return $this->filter(function ($value) {
            return !is_null($value);
        })->reduce(function ($result, $item) use ($callback) {
            $value = $callback($item);

            return is_null($result) || $value > $result ? $value : $result;
        });
    }
public function max($key = null)
    {
        $callback = $this->valueAccessor($key);

        return $this->filter(function ($value) {
            return !is_null($value);
        })->reduce(function ($result, $item) use ($callback) {
            $value = $callback($item);

            return is_null($result) || $value > $result ? $value : $result;
        });
    }
public function max ( $ key = null ) { $ callback = $ this -> valueAccessor ( $ key ) ; return $ this -> filter ( function ( $ value ) { return ! is_null ( $ value ) ; } ) -> reduce ( function ( $ result , $ item ) use ( $ callback ) { $ value = $ callback ( $ item ) ; return is_null ( $ result ) || $ value > $ result ? $ value : $ result ; } ) ; }
Returns the highest value from the collection of values

Key can be a string key or callable. Based on Laravel: Illuminate\Support\Collection.max

@param null|string $key

@return mixed
Returns the highest value from the collection of values