Skip to content

Commit 3aeb471

Browse files
authored
Merge pull request #4796 from Laravel-Backpack/re-set-query-bindings
[Bug] Missing query bindings lead to error when using `withCount` in the query.
2 parents 5f5f666 + d1cd123 commit 3aeb471

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/app/Library/CrudPanel/Traits/Query.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ private function getCountFromQuery(Builder $query)
257257
// - orders/limit/offset because we want the "full query count" where orders don't matter and limit/offset would break the total count
258258
$subQuery = $crudQuery->cloneWithout(['columns', 'orders', 'limit', 'offset']);
259259

260+
// re-set the previous query bindings
261+
$subQuery->setBindings($crudQuery->getRawBindings());
262+
260263
// select only one column for the count
261264
$subQuery->select($modelTable.'.'.$this->model->getKeyName());
262265

0 commit comments

Comments
 (0)