Skip to content

Commit db2a58d

Browse files
authored
Merge pull request #1988 from royduin/patch-1
[8.0] Keep select bindings option.
2 parents 8aedd88 + fad575b commit db2a58d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/QueryDataTable.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ class QueryDataTable extends DataTableAbstract
5252
*/
5353
protected $skipTotalRecords = false;
5454

55+
/**
56+
* Flag to keep the select bindings.
57+
*
58+
* @var bool
59+
*/
60+
protected $keepSelectBindings = false;
61+
5562
/**
5663
* Can the DataTable engine be created with these parameters.
5764
*
@@ -131,6 +138,18 @@ public function skipTotalRecords()
131138
return $this;
132139
}
133140

141+
/**
142+
* Keep the select bindings.
143+
*
144+
* @return $this
145+
*/
146+
public function keepSelectBindings()
147+
{
148+
$this->keepSelectBindings = true;
149+
150+
return $this;
151+
}
152+
134153
/**
135154
* Count total items.
136155
*
@@ -187,7 +206,9 @@ protected function prepareCountQuery()
187206
if (! $this->isComplexQuery($builder)) {
188207
$row_count = $this->wrap('row_count');
189208
$builder->select($this->connection->raw("'1' as {$row_count}"));
190-
$builder->setBindings([], 'select');
209+
if (! $this->keepSelectBindings) {
210+
$builder->setBindings([], 'select');
211+
}
191212
}
192213

193214
return $builder;

0 commit comments

Comments
 (0)