'require|checkData', 'custom_id' => 'require|checkCustom', 'name' => 'require', 'gender' => 'in:0,1', 'mobile' => 'mobile', 'email' => 'email', ]; /** * 参数描述 * @var string[] */ protected $field = [ 'id' => 'id', 'custom_id' => '客户id', 'name' => '姓名', 'dept' => '部门', 'gender' => '姓名 0-男 1-女', 'job' => '职务', 'mobile' => '手机', 'telephone' => '电话', 'email' => '邮箱', 'qq' => 'QQ', 'remark' => '备注', ]; /** * @notes 添加场景 * @return MarketingCustomContactsValidate * @author likeadmin * @date 2024/04/01 14:26 */ public function sceneAdd() { return $this->only(['custom_id', 'name', 'dept', 'gender', 'job', 'mobile', 'telephone', 'email', 'qq', 'remark']); } /** * @notes 编辑场景 * @return MarketingCustomContactsValidate * @author likeadmin * @date 2024/04/01 14:26 */ public function sceneEdit() { return $this->only(['id', 'custom_id', 'name', 'dept', 'gender', 'job', 'mobile', 'telephone', 'email', 'qq', 'remark']); } /** * @notes 删除场景 * @return MarketingCustomContactsValidate * @author likeadmin * @date 2024/04/01 14:26 */ public function sceneDelete() { return $this->only(['id'])->remove('id', 'checkData'); } /** * @notes 详情场景 * @return MarketingCustomContactsValidate * @author likeadmin * @date 2024/04/01 14:26 */ public function sceneDetail() { return $this->only(['id']); } public function checkData($value): bool|string { $data = MarketingCustomContacts::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '数据不存在' : true; } public function checkCustom($value): bool|string { $data = MarketingCustom::where('id', $value)->findOrEmpty(); return $data->isEmpty() ? '客户信息不存在' : true; } }