fix:material_category

This commit is contained in:
LAPTOP-7SGDREK0\shiweijun
2025-02-27 16:55:58 +08:00
parent c044dba6a6
commit 604c6ff799
2 changed files with 6 additions and 0 deletions

View File

@@ -37,5 +37,6 @@ class MaterialCategoryRequest extends FormRequest
'add' => ['name', 'parent_id', 'city_id', 'kitchen_id'],
'edit' => ['id','name', 'parent_id'],
'delete' => ['id'],
'list' => ['query_city_id'],
];
}

View File

@@ -105,7 +105,12 @@ class MaterialCategoryService extends BaseService{
*/
public function list(): array
{
$cityId = (int)$this->request->input('query_city_id');
$list = $this->MaterialCategoryModel
->when($cityId > 0,function($query) use($cityId){
$query->where('city_id',$cityId);
})
->where('is_del',MaterialCode::IS_NO_DEL)->get();
return $this->return->success('success',['list' => $list->toArray()]);