File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,12 @@ public function prepareCountQuery(): QueryBuilder
176
176
$ builder ->select (DB ::raw ('1 as dt_row_count ' ));
177
177
$ clone = $ builder ->clone ();
178
178
$ clone ->setBindings ([]);
179
- $ clone ->wheres = [];
179
+ if ($ clone instanceof EloquentBuilder) {
180
+ $ clone ->getQuery ()->wheres = [];
181
+ } else {
182
+ $ clone ->wheres = [];
183
+ }
184
+
180
185
if ($ this ->isComplexQuery ($ clone )) {
181
186
if (!$ this ->ignoreSelectInCountQuery ) {
182
187
$ builder = clone $ this ->query ;
@@ -188,8 +193,8 @@ public function prepareCountQuery(): QueryBuilder
188
193
->setBindings ($ builder ->getBindings ());
189
194
}
190
195
}
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 }" ));
193
198
194
199
if (!$ this ->keepSelectBindings ) {
195
200
$ builder ->setBindings ([], 'select ' );
You can’t perform that action at this time.
0 commit comments