improved list filters

This commit is contained in:
denisdulici
2018-12-27 13:56:56 +03:00
parent e85397b582
commit 69a30eed6b
3 changed files with 24 additions and 3 deletions

View File

@@ -16,7 +16,14 @@ class Items extends ModelFilter
public function search($query)
{
return $this->whereLike('name', $query);
$model = $this->where('name', 'LIKE', '%' . $query . '%');
$or_fields = ['sku', 'description'];
foreach ($or_fields as $or_field) {
$model->orWhere($or_field, 'LIKE', '%' . $query . '%');
}
return $model;
}
public function categories($ids)