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
164164 $ builder = clone $ this ->query ;
165165
166166 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 ' ));
168169
169- if ($ this ->ignoreSelectInCountQuery || ! $ this ->isComplexQuery ($ builder )) {
170+ if ($ this ->ignoreSelectInCountQuery || ! $ this ->isComplexQuery ($ query_without_selects )) {
170171 return $ this ->getConnection ()
171172 ->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 ());
174175 }
175176
176- $ builder = clone $ this ->query ;
177-
178177 return $ this ->getConnection ()
179178 ->query ()
180179 ->fromRaw ('( ' .$ builder ->toSql ().') count_row_table ' )
You can’t perform that action at this time.
0 commit comments