Skip to content

Commit f814ae9

Browse files
committed
Update QueryDataTable.php
1 parent e962328 commit f814ae9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/QueryDataTable.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,12 @@ public function prepareCountQuery(): QueryBuilder
176176
$builder->select(DB::raw('1 as dt_row_count'));
177177
$clone = $builder->clone();
178178
$clone->setBindings([]);
179-
$clone->wheres = [];
179+
if ($clone instanceof EloquentBuilder) {
180+
$clone->getQuery()->wheres = [];
181+
} else {
182+
$clone->wheres = [];
183+
}
184+
180185
if ($this->isComplexQuery($clone)) {
181186
if (!$this->ignoreSelectInCountQuery) {
182187
$builder = clone $this->query;
@@ -188,8 +193,8 @@ public function prepareCountQuery(): QueryBuilder
188193
->setBindings($builder->getBindings());
189194
}
190195
}
191-
$row_count = $this->wrap('row_count');
192-
$builder->select($this->getConnection()->raw("'1' as {$row_count}"));
196+
$row_count = $this->wrap('row_count');
197+
$builder->select($this->getConnection()->raw("'1' as {$row_count}"));
193198

194199
if (!$this->keepSelectBindings) {
195200
$builder->setBindings([], 'select');

0 commit comments

Comments
 (0)