filter search fix
This commit is contained in:
parent
72f528e75d
commit
a549c0ed75
@ -55,6 +55,11 @@ try {
|
||||
'class' => \Itguild\Tables\Filter\InputTextFilter::class
|
||||
]
|
||||
],
|
||||
'role' => [
|
||||
'filter' => [
|
||||
'class' => \Itguild\Tables\Filter\InputTextFilter::class
|
||||
],
|
||||
],
|
||||
'created_at' => [
|
||||
'format' => 'date:d-m-Y',
|
||||
'filter' => [
|
||||
|
@ -4,6 +4,7 @@ namespace Itguild\EloquentTable;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use itguild\forms\debug\Debug;
|
||||
|
||||
class EloquentDataProvider
|
||||
@ -61,7 +62,12 @@ class EloquentDataProvider
|
||||
if ($this->meta['searchParams']){
|
||||
foreach ($this->meta['searchParams'] as $name => $param){
|
||||
if (array_key_exists($name, $this->meta['columns']) && !empty($param)){
|
||||
$this->queryBuilder->where($name, $this->meta['searchParams'][$name]);
|
||||
if (is_numeric($param)){
|
||||
$this->queryBuilder->where($name, $this->meta['searchParams'][$name]);
|
||||
}
|
||||
elseif (is_string($param)){
|
||||
$this->queryBuilder->where($name,'like', '%' . $param. '%');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ class User extends Model {
|
||||
'username' => 'Логин',
|
||||
'email' => 'Email',
|
||||
'created_at' => 'Создан',
|
||||
'updated_at' => 'Обновлен'
|
||||
'updated_at' => 'Обновлен',
|
||||
'role' => 'Роль'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user