WithdrawAuditRequest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Http\Requests\Admin\Wallet;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. use App\Enums\WithdrawAuditStatus;
  5. class WithdrawAuditRequest extends FormRequest
  6. {
  7. /**
  8. * Get the validation rules that apply to the request.
  9. *
  10. * @return array
  11. */
  12. public function rules(): array
  13. {
  14. return [
  15. 'status' => ['required', 'integer', 'in:' . implode(',', [
  16. WithdrawAuditStatus::APPROVED->value,
  17. WithdrawAuditStatus::REJECTED->value,
  18. ])],
  19. 'remark' => ['nullable', 'string', 'max:255'],
  20. ];
  21. }
  22. /**
  23. * Get custom messages for validator errors.
  24. *
  25. * @return array
  26. */
  27. public function messages(): array
  28. {
  29. return [
  30. 'status.required' => '请选择审核状态',
  31. 'status.integer' => '审核状态格式错误',
  32. 'status.in' => '审核状态无效',
  33. 'remark.string' => '审核备注必须是字符串',
  34. 'remark.max' => '审核备注不能超过255个字符',
  35. ];
  36. }
  37. }