We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4271f77 commit 4f80389Copy full SHA for 4f80389
src/QueryDataTable.php
@@ -210,7 +210,17 @@ protected function filteredCount()
210
*/
211
public function count()
212
{
213
- return $this->prepareCountQuery()->count();
+ $builder = $this->prepareCountQuery();
214
+
215
+ if (empty($builder->havings)) {
216
+ return $builder->count();
217
+ }
218
219
+ $table = $this->connection->raw('('.$builder->toSql().') count_row_table');
220
221
+ return $this->connection->table($table)
222
+ ->setBindings($builder->getBindings())
223
+ ->count();
224
}
225
226
/**
0 commit comments