Jet\DataListing_Filter_Search
Already pre-made filter for search. Just implement WHERE generation.
Example:
namespace JetApplicationModule\EventViewer\REST;
use Jet\DataListing_Filter_Search;
class Listing_Filter_Search extends DataListing_Filter_Search {
public const KEY = 'search';
public function getKey(): string
{
return static::KEY;
}
public function generateWhere(): void
{
if( $this->search ) {
$search = '%'.$this->search.'%';
$this->listing->addFilterWhere([
'event *' => $search,
'OR',
'event_class *' => $search,
'OR',
'event_message *' => $search,
]);
}
}
}