From 1a1601efa4ab9fe06a64b22b432070692eb4e0c4 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 24 Mar 2022 23:46:47 +0300 Subject: [PATCH] Reset ORDER BY and LIMIT before pagination query (#56) Without this change a query will wail with an error or show wrong results. --- src/Integrations/Laravel/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Integrations/Laravel/Builder.php b/src/Integrations/Laravel/Builder.php index 62b0a3a..d0b9b6b 100644 --- a/src/Integrations/Laravel/Builder.php +++ b/src/Integrations/Laravel/Builder.php @@ -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();