QualAuthRequest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Http\Requests\Coach\Auth;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class QualAuthRequest extends FormRequest
  5. {
  6. public function authorize(): bool
  7. {
  8. return true;
  9. }
  10. public function rules(): array
  11. {
  12. return [
  13. 'qual_type' => 'required|string|max:255',
  14. 'qual_no' => 'nullable|string|max:255',
  15. 'qual_photo' => 'required|string|max:255',
  16. 'valid_start' => 'nullable|date',
  17. 'valid_end' => 'nullable|date|after_or_equal:valid_start'
  18. ];
  19. }
  20. public function messages(): array
  21. {
  22. return [
  23. 'qual_type.required' => '资质类型不能为空',
  24. 'qual_type.max' => '资质类型不能超过255个字符',
  25. 'qual_no.max' => '资质证书编号不能超过255个字符',
  26. 'qual_photo.required' => '资质证书照片不能为空',
  27. 'qual_photo.max' => '资质证书照片地址不能超过255个字符',
  28. 'valid_start.date' => '有效期开始日期格式不正确',
  29. 'valid_end.date' => '有效期结束日期格式不正确',
  30. 'valid_end.after_or_equal' => '有效期结束日期必须大于或等于开始日期'
  31. ];
  32. }
  33. }