File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -164,17 +164,16 @@ public function prepareCountQuery(): QueryBuilder
164
164
$ builder = clone $ this ->query ;
165
165
166
166
if ($ this ->isComplexQuery ($ builder )) {
167
- $ builder ->select (DB ::raw ('1 ' ));
167
+ $ query_without_selects = clone $ this ->query ;
168
+ $ query_without_selects ->select (DB ::raw ('1 ' ));
168
169
169
- if ($ this ->ignoreSelectInCountQuery || ! $ this ->isComplexQuery ($ builder )) {
170
+ if ($ this ->ignoreSelectInCountQuery || ! $ this ->isComplexQuery ($ query_without_selects )) {
170
171
return $ this ->getConnection ()
171
172
->query ()
172
- ->fromRaw ('( ' .$ builder ->toSql ().') count_row_table ' )
173
- ->setBindings ($ builder ->getBindings ());
173
+ ->fromRaw ('( ' .$ query_without_selects ->toSql ().') count_row_table ' )
174
+ ->setBindings ($ query_without_selects ->getBindings ());
174
175
}
175
176
176
- $ builder = clone $ this ->query ;
177
-
178
177
return $ this ->getConnection ()
179
178
->query ()
180
179
->fromRaw ('( ' .$ builder ->toSql ().') count_row_table ' )
You can’t perform that action at this time.
0 commit comments