'require|checkData', 'work_contact_id' => 'require|checkWorkContact', 'problem_name' => 'require', 'problem_description' => 'require', ]; /** * 参数描述 * @var string[] */ protected $field = [ 'id' => 'id', 'work_contact_id' => '监理工作联系单id', 'problem_name' => '问题名称', 'problem_description' => '问题说明', ]; /** * @notes 添加场景 * @return SupervisionWorkContactProblemValidate * @author likeadmin * @date 2024/03/01 11:01 */ public function sceneAdd() { return $this->only(['work_contact_id','problem_name','problem_description']); } /** * @notes 编辑场景 * @return SupervisionWorkContactProblemValidate * @author likeadmin * @date 2024/03/01 11:01 */ public function sceneEdit() { return $this->only(['id','work_contact_id','problem_name','problem_description']); } /** * @notes 删除场景 * @return SupervisionWorkContactProblemValidate * @author likeadmin * @date 2024/03/01 11:01 */ public function sceneDelete() { return $this->only(['id']); } /** * @notes 详情场景 * @return SupervisionWorkContactProblemValidate * @author likeadmin * @date 2024/03/01 11:01 */ public function sceneDetail() { return $this->only(['id']); } public function checkData($value): bool|string { $data = SupervisionWorkContactProblem::where('id',$value)->findOrEmpty(); if($data->isEmpty()){ return '数据不存在'; } return true; } public function checkWorkContact($value): bool|string { $data = SupervisionWorkContact::where('id',$value)->findOrEmpty(); if($data->isEmpty()){ return '工作联系单信息不存在'; } return true; } }