Skip to content

Commit efeb8be

Browse files
authored
Keep select bindings option
1 parent 8aedd88 commit efeb8be

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
@@ -51,6 +51,13 @@ class QueryDataTable extends DataTableAbstract
5151
* @var bool
5252
*/
5353
protected $skipTotalRecords = false;
54+
55+
/**
56+
* Flag to keep the select bindings.
57+
*
58+
* @var bool
59+
*/
60+
protected $keepSelectBindings = false;
5461

5562
/**
5663
* Can the DataTable engine be created with these parameters.
@@ -130,6 +137,18 @@ public function skipTotalRecords()
130137

131138
return $this;
132139
}
140+
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+
}
133152

134153
/**
135154
* Count total items.
@@ -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)