refactor: 修改几在模块支持多分类筛选

This commit is contained in:
2025-06-06 11:24:58 +08:00
parent 732132f287
commit a821156077
7 changed files with 43 additions and 3 deletions

View File

@@ -65,10 +65,18 @@ class ProductModel extends ProductBaseModel
if (is_null($value)) {
return;
}
if (is_array($value) || str_contains($value, ',')) {
$query->whereIn('category_id', $value);
return;
}
$query->where('category_id', '=', $value);
}
public function scopeCategory($query, $value)
{
if (is_array($value) || str_contains($value, ',')) {
$query->whereIn('category_id', $value);
return;
}
$query->where('category_id', '=', $value);
}