23 lines
496 B
PHP
23 lines
496 B
PHP
<?php
|
|
|
|
namespace App\ModelFilters;
|
|
|
|
use EloquentFilter\ModelFilter;
|
|
|
|
class UserFilter extends ModelFilter
|
|
{
|
|
/**
|
|
* Related Models that have ModelFilters as well as the method on the ModelFilter
|
|
* As [relationMethod => [input_key1, input_key2]].
|
|
*
|
|
* @var array
|
|
*/
|
|
public $relations = [];
|
|
|
|
public function search($key)
|
|
{
|
|
$str = '%'.$key.'%';
|
|
return $this->where(fn($q) => $q->where('phone', 'like', $str)->orWhere('name', 'like', $str));
|
|
}
|
|
}
|