'require|checkData', 'material_entry_id' => 'require|checkMaterialEntry', 'name' => 'require', 'brand' => 'require', 'model' => 'require', 'unit' => 'require', 'contract_brand' => 'require|in:0,1', 'entry_number' => 'require|float', ]; /** * 参数描述 * @var string[] */ protected $field = [ 'id' => 'id', 'material_entry_id' => '材料进场id', 'name' => '材料名称', 'brand' => '材料品牌', 'model' => '材料型号', 'unit' => '计数单位', 'contract_brand' => '合同约定品牌', 'entry_number' => '进场数量', ]; /** * @notes 添加场景 * @return SupervisionMaterialEntryDetailValidate * @author likeadmin * @date 2024/02/28 13:41 */ public function sceneAdd() { return $this->only(['material_entry_id','name','brand','model','unit','contract_brand','entry_number']); } /** * @notes 编辑场景 * @return SupervisionMaterialEntryDetailValidate * @author likeadmin * @date 2024/02/28 13:41 */ public function sceneEdit() { return $this->only(['id','material_entry_id','name','brand','model','unit','contract_brand','entry_number']); } /** * @notes 删除场景 * @return SupervisionMaterialEntryDetailValidate * @author likeadmin * @date 2024/02/28 13:41 */ public function sceneDelete() { return $this->only(['id']); } /** * @notes 详情场景 * @return SupervisionMaterialEntryDetailValidate * @author likeadmin * @date 2024/02/28 13:41 */ public function sceneDetail() { return $this->only(['id']); } public function checkData($value): bool|string { $data = SupervisionMaterialEntryDetail::where('id',$value)->findOrEmpty(); if($data->isEmpty()){ return '数据不存在'; } return true; } public function checkMaterialEntry($value): bool|string { $data = SupervisionMaterialEntry::where('id',$value)->findOrEmpty(); if($data->isEmpty()){ return '材料进场信息不存在'; } return true; } }