Skip to content

Conversation

MostafaRabia
Copy link

@MostafaRabia MostafaRabia commented Sep 3, 2020

Order desc was sorting per page, not like real pagination, now it's working with me well.

fix for #260

Order desc was sorting per page, not like real pagination, now it's working with me well.
That's better, the perv if the paginate 20 and last page has 4 results won't get them.
There is changes i don't understand it, but it works to me like in charm, get all IDs then order them in paginate, no more "rsort" or something else.
But i don't understand "keyBy($model->getKeyName())", if my pagination IDs is:
10
9
3
By "keyBy($model->getKeyName());" turns to:
3
9
10

So i deleted it and the:
return $models->newCollection($results['ids'])->map(function ($hit) use ($models) {
            if (isset($models[$hit])) {
                return $models[$hit];
            }
        })->filter()->values();
too, and it's working now, working too if your pagination not in default name "page".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant