Compare commits

...

2 Commits

Author SHA1 Message Date
vine_liutk b3ef13654a 修改 2022-11-09 12:14:34 +08:00
vine_liutk 069ecb1e44 修改 2022-11-09 12:14:12 +08:00
1 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ class CropController extends Controller
$input = $request->input();
if ($input['is_end'] != $crop->is_end) {
if ($crop->is_end || Crop::where(['parent_id', $crop->id])->exists()) {
if ($crop->is_end || Crop::where(['parent_id' => $crop->id])->exists()) {
return $this->error('无法修改结点状态');
}
}
@ -55,7 +55,7 @@ class CropController extends Controller
$input['path'] = ($parent?->path ?? '').$parent?->id.'-';
}
$crop->update(array_merge($request->input()));
$crop->update(array_merge($request->input(), $input));
return $this->success('修改成功');
}
@ -67,7 +67,7 @@ class CropController extends Controller
return $this->error('该结点有关联产量数据, 无法删除');
}
//如果有子节点,无法删除
if (Crop::where(['parent_id', $crop->id])->exists()) {
if (Crop::where(['parent_id' => $crop->id])->exists()) {
return $this->error('该结点有关联产量数据, 无法删除');
}