src/Jackiedo/LogReader/LogReader.php
protected function postCollectionModifiers(Collection $collection)
    {
        if ($this->getOrderByField() && $this->getOrderByDirection()) {
            $field = $this->getOrderByField();
            $desc  = false;

            if ($this->getOrderByDirection() === 'desc') {
                $desc = true;
            }

            $sorted = $collection->sortBy(function ($entry) use ($field) {
                if (property_exists($entry, $field)) {
                    return $entry->{$field};
                }
            }, SORT_NATURAL, $desc);

            return $sorted;
        }

        return $collection;
    }
protected function postCollectionModifiers(Collection $collection)
    {
        if ($this->getOrderByField() && $this->getOrderByDirection()) {
            $field = $this->getOrderByField();
            $desc  = false;

            if ($this->getOrderByDirection() === 'desc') {
                $desc = true;
            }

            $sorted = $collection->sortBy(function ($entry) use ($field) {
                if (property_exists($entry, $field)) {
                    return $entry->{$field};
                }
            }, SORT_NATURAL, $desc);

            return $sorted;
        }

        return $collection;
    }
protected function postCollectionModifiers ( Collection $ collection ) { if ( $ this -> getOrderByField ( ) && $ this -> getOrderByDirection ( ) ) { $ field = $ this -> getOrderByField ( ) ; $ desc = false ; if ( $ this -> getOrderByDirection ( ) === 'desc' ) { $ desc = true ; } $ sorted = $ collection -> sortBy ( function ( $ entry ) use ( $ field ) { if ( property_exists ( $ entry , $ field ) ) { return $ entry -> { $ field } ; } } , SORT_NATURAL , $ desc ) ; return $ sorted ; } return $ collection ; }
Modifies and returns the collection result if modifiers are set
such as an orderBy.

@param  Collection  $collection

@return Collection
Modifies and returns the collection result if modifiers are set such as an orderBy .