amrnn90 / laravel-cursor-paginator

Cursor pagination for Laravel
MIT License
19 stars 7 forks source link

[QueryHelper] ErrorException: Undefined offset: 1 #30

Closed DeepDiver1975 closed 3 years ago

DeepDiver1975 commented 3 years ago

In case a give cursor holds 2 targets but the query has only one order by the code below in class QueryHelper throws an ErrorException.

It is an exceptional scenario but should be taken care of properly.

    protected function getOrderDirection($query, $index)
    {
        return $this->extractQueryObject($query)->orders[$index]['direction'];
    }
DeepDiver1975 commented 3 years ago

Maintaining my own fork now: https://github.com/DeepDiver1975/laravel-cursor-paginator