Skip to content

Commit

Permalink
Reset ORDER BY and LIMIT before pagination query (#56)
Browse files Browse the repository at this point in the history
Without this change a query will wail with an error or show wrong results.
  • Loading branch information
tachigami authored Mar 24, 2022
1 parent 9af85f4 commit 1a1601e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Integrations/Laravel/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function delete()
public function paginate(int $page = 1, int $perPage = 15): LengthAwarePaginator
{
$count = (int) $this->getConnection()
->table($this->cloneWithout(['columns' => []])
->table($this->cloneWithout(['columns' => [], 'orders' => [], 'limit' => null])
->select(new Expression('1')))
->count();

Expand Down

0 comments on commit 1a1601e

Please sign in to comment.