feat: 新增产品分类用于下拉框场景列表树接口

This commit is contained in:
2025-03-28 16:57:23 +08:00
parent 2d3964f5c4
commit cfba4af57c
3 changed files with 19 additions and 4 deletions

View File

@@ -29,9 +29,17 @@ class ProductCategoryModel extends ProductCategoryBaseModel
$query->where('language_id', '=', $value);
}
// 根据是否显示查询
public function scopeIsShow($query, bool $value)
/**
* 根据是否显示查询
* @param $query
* @param \Closure:bool|bool $value
*/
public function scopeIsShow($query, \Closure|bool $value)
{
if (is_callable($value)) {
$query->where('is_show', '=', $value());
return;
}
$query->where('is_show', '=', (int)$value);
}