'require|checkData', ]; /** * 参数描述 * @var string[] */ protected $field = [ 'id' => 'id', ]; /** * @notes 添加场景 * @return CostApprovedProjectValidate * @author likeadmin * @date 2024/02/20 14:16 */ public function sceneAdd() { return $this->remove('id', true); } /** * @notes 编辑场景 * @return CostApprovedProjectValidate * @author likeadmin * @date 2024/02/20 14:16 */ public function sceneEdit() { return $this->only(['id']); } /** * @notes 删除场景 * @return CostApprovedProjectValidate * @author likeadmin * @date 2024/02/20 14:16 */ public function sceneDelete() { return $this->only(['id'])->remove('id', 'checkData'); } /** * @notes 详情场景 * @return CostApprovedProjectValidate * @author likeadmin * @date 2024/02/20 14:16 */ public function sceneDetail() { return $this->only(['id']); } public function checkData($value): bool|string { $data = MarketingContract::field('id')->where('id', $value)->findOrEmpty(); if ($data->isEmpty()) { return '数据不存在'; } return true; } }