FeedbackRequest.php 759 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Requests\Client\User;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class FeedbackRequest extends FormRequest
  5. {
  6. public function authorize(): bool
  7. {
  8. return true;
  9. }
  10. public function rules(): array
  11. {
  12. return [
  13. 'content' => 'required|string|max:1000',
  14. 'images' => 'nullable|array',
  15. 'images.*' => 'string|url|max:255',
  16. 'contact' => 'nullable|string|max:50',
  17. ];
  18. }
  19. public function messages(): array
  20. {
  21. return [
  22. 'content.required' => '反馈内容不能为空',
  23. 'content.max' => '反馈内容不能超过1000个字符',
  24. 'images.*.url' => '图片必须是有效的URL地址',
  25. ];
  26. }
  27. }