fix:material_category

This commit is contained in:
LAPTOP-7SGDREK0\shiweijun
2025-02-28 09:48:16 +08:00
parent 09603ee33a
commit 01d70dd374
2 changed files with 3 additions and 5 deletions

View File

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

View File

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