aarondfrancis / fast-paginate

A fast implementation of offset/limit pagination for Laravel.
MIT License
1.21k stars 56 forks source link

Support ordering by withCount #16

Closed aarondfrancis closed 2 years ago

aarondfrancis commented 2 years ago

This is a PR to address issue #14.

PR #15 also addresses issue #14, but does so in a bit more brute force way. This PR seeks to address the fact that some subselects might be used for ordering, but not all of them. And some subselects are quite expensive so we want to exclude them whenever possible.

If a subselect is reference as an ordered column, then it will be preserved in the inner query, otherwise it will be skipped.