|
@@ -14,31 +14,76 @@ class ApplyCoachRequest extends FormRequest
|
|
|
public function rules(): array
|
|
|
{
|
|
|
return [
|
|
|
- 'mobile' => 'required|string|size:11|regex:/^1[3-9]\d{9}$/',
|
|
|
- 'gender' => 'required|integer|in:1,2',
|
|
|
- 'work_years' => 'required|integer|min:0|max:50',
|
|
|
- 'intention_city' => 'required|string|max:50',
|
|
|
- 'portrait_images' => 'required|array',
|
|
|
- 'portrait_images.*' => 'required|string|url|max:255',
|
|
|
- 'description' => 'nullable|string|max:1000',
|
|
|
+ 'age' => [
|
|
|
+ 'required',
|
|
|
+ 'integer',
|
|
|
+ 'min:18',
|
|
|
+ 'max:60',
|
|
|
+ ],
|
|
|
+ 'mobile' => [
|
|
|
+ 'required',
|
|
|
+ 'string',
|
|
|
+ 'regex:/^1[3-9]\d{9}$/',
|
|
|
+ ],
|
|
|
+ 'gender' => [
|
|
|
+ 'required',
|
|
|
+ 'integer',
|
|
|
+ 'in:1,2',
|
|
|
+ ],
|
|
|
+ 'work_years' => [
|
|
|
+ 'required',
|
|
|
+ 'integer',
|
|
|
+ 'min:0',
|
|
|
+ 'max:50',
|
|
|
+ ],
|
|
|
+ 'intention_city' => [
|
|
|
+ 'required',
|
|
|
+ 'string',
|
|
|
+ 'max:50',
|
|
|
+ ],
|
|
|
+ 'portrait_images' => [
|
|
|
+ 'required',
|
|
|
+ 'array',
|
|
|
+ 'min:1',
|
|
|
+ 'max:6',
|
|
|
+ ],
|
|
|
+ 'portrait_images.*' => [
|
|
|
+ 'required',
|
|
|
+ 'string',
|
|
|
+ 'url',
|
|
|
+ ],
|
|
|
+ 'description' => [
|
|
|
+ 'nullable',
|
|
|
+ 'string',
|
|
|
+ 'max:1000',
|
|
|
+ ],
|
|
|
];
|
|
|
}
|
|
|
|
|
|
public function messages(): array
|
|
|
{
|
|
|
return [
|
|
|
+ 'age.required' => '年龄不能为空',
|
|
|
+ 'age.integer' => '年龄必须是整数',
|
|
|
+ 'age.min' => '年龄不能小于18岁',
|
|
|
+ 'age.max' => '年龄不能大于60岁',
|
|
|
'mobile.required' => '手机号不能为空',
|
|
|
'mobile.regex' => '手机号格式不正确',
|
|
|
'gender.required' => '性别不能为空',
|
|
|
- 'gender.integer' => '性别必须是整数',
|
|
|
'gender.in' => '性别只能是1(男)或2(女)',
|
|
|
'work_years.required' => '工作年限不能为空',
|
|
|
'work_years.integer' => '工作年限必须是整数',
|
|
|
'work_years.min' => '工作年限不能小于0年',
|
|
|
'work_years.max' => '工作年限不能超过50年',
|
|
|
'intention_city.required' => '意向城市不能为空',
|
|
|
- 'portrait_images.required' => '形象图片不能为空',
|
|
|
- 'portrait_images.*.url' => '图片必须是有效的URL地址',
|
|
|
+ 'intention_city.max' => '意向城市不能超过50个字符',
|
|
|
+ 'portrait_images.required' => '形象照片不能为空',
|
|
|
+ 'portrait_images.array' => '形象照片必须是数组',
|
|
|
+ 'portrait_images.min' => '至少上传1张形象照片',
|
|
|
+ 'portrait_images.max' => '最多上传6张形象照片',
|
|
|
+ 'portrait_images.*.required' => '形象照片不能为空',
|
|
|
+ 'portrait_images.*.url' => '形象照片必须是有效的URL地址',
|
|
|
+ 'description.max' => '个人介绍不能超过1000个字符',
|
|
|
];
|
|
|
}
|
|
|
}
|