refactor: 修改导航验证场景

This commit is contained in:
2025-03-07 09:39:38 +08:00
parent 2a37e72317
commit dead02345c

View File

@@ -80,9 +80,15 @@ class NavigationItemValidate extends Validate
return true;
}
// 定义场景
protected $scene = [
'add' => ['nav_id', 'pid', 'name', 'icon', 'link_type', 'link', 'sort', 'blank', 'status'],
'edit' => ['id', 'nav_id', 'pid', 'name', 'icon', 'link_type', 'link', 'sort', 'blank', 'status'],
];
// 新增场景
public function sceneAdd()
{
return $this->only(['nav_id', 'pid', 'name', 'icon', 'link_type', 'link', 'sort', 'blank', 'status'])->remove('pid', 'different');
}
// 更新场景
public function sceneEdit()
{
return $this->only(['id', 'nav_id', 'pid', 'name', 'icon', 'link_type', 'link', 'sort', 'blank', 'status']);
}
}