Skip to content

Commit 6f821bc

Browse files
committed
fixed pagination query on searchable builder
1 parent 070d7e0 commit 6f821bc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Query/Builder.php

+16
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,20 @@ protected function restoreFieldsForCount()
8787

8888
$this->backups = $this->bindingBackups = [];
8989
}
90+
91+
/**
92+
* Run a pagination count query.
93+
*
94+
* @param array $columns
95+
* @return array
96+
*/
97+
protected function runPaginationCountQuery($columns = ['*'])
98+
{
99+
$bindings = $this->from instanceof Subquery ? ['order'] : ['select', 'order'];
100+
101+
return $this->cloneWithout(['columns', 'orders', 'limit', 'offset'])
102+
->cloneWithoutBindings($bindings)
103+
->setAggregate('count', $this->withoutSelectAliases($columns))
104+
->get()->all();
105+
}
90106
}

0 commit comments

Comments
 (0)