Skip to content

Commit 27ce91a

Browse files
committed
Refactor, add searchableQuery() method
1 parent f1c592b commit 27ce91a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/BaseGridQuery.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,17 @@ public function __call($method, $parameters)
249249
*/
250250
public function search($searchStr)
251251
{
252-
$query = $this->searcher()->search($searchStr);
252+
return $this->searcher()->search($searchStr);
253+
}
254+
255+
/**
256+
* Prepare and return the searchable query.
257+
*
258+
* @return \Illuminate\Database\Eloquent\Builder
259+
*/
260+
protected function searchableQuery()
261+
{
262+
$query = $this->makeQuery();
253263

254264
if ($this->paginated) {
255265
$query->limit($this->pageLimitter()->limit());
@@ -267,8 +277,8 @@ public function search($searchStr)
267277
public function searcher()
268278
{
269279
return new SublimeSearch(
270-
$this->makeQuery(),
271-
$this->columnKeys(),
280+
$this->searchableQuery(),
281+
$this->searchOperator === 'having' ? $this->columnKeys() : array_values($this->columns()),
272282
true,
273283
method_exists($this, 'sortColumns') ? $this->sortColumns() : $this->columns(),
274284
$this->searchOperator

0 commit comments

Comments
 (0)