Skip to content

Commit f1c592b

Browse files
committed
Add setSearchOperator()
1 parent e1e76a5 commit f1c592b

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/BaseGridQuery.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ abstract class BaseGridQuery
3636
*/
3737
protected $page = 1;
3838

39+
/**
40+
* Search operator.
41+
* Whether to use where or having in query to compare columns against search string.
42+
* Values: where, having.
43+
*
44+
* @var string
45+
*/
46+
protected $searchOperator = 'having';
47+
3948
/**
4049
* Return the initialized specific query. This contains the joins logic and condition that make the query specific.
4150
*
@@ -262,10 +271,23 @@ public function searcher()
262271
$this->columnKeys(),
263272
true,
264273
method_exists($this, 'sortColumns') ? $this->sortColumns() : $this->columns(),
265-
'having'
274+
$this->searchOperator
266275
);
267276
}
268277

278+
/**
279+
* Set search operator.
280+
*
281+
* @param string $searchOperator
282+
* @return $this
283+
*/
284+
public function setSearchOperator($searchOperator)
285+
{
286+
$this->searchOperator = $searchOperator;
287+
288+
return $this;
289+
}
290+
269291
/**
270292
* Initialize query.
271293
*

0 commit comments

Comments
 (0)