MiniprogramUpdateRequest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace Modules\Manage\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. use Illuminate\Validation\Rule;
  5. use Modules\Manage\Enmus\MiniprogramType;
  6. class MiniprogramUpdateRequest extends FormRequest
  7. {
  8. /**
  9. * Determine if the user is authorized to make this request.
  10. */
  11. public function authorize(): bool
  12. {
  13. return true;
  14. }
  15. /**
  16. * Get the validation rules that apply to the request.
  17. *
  18. * @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
  19. */
  20. public function rules(): array
  21. {
  22. return [
  23. 'name'=> 'required|max:50',
  24. 'play_name'=> 'required|max:100',
  25. 'company'=> 'required|max:255',
  26. 'type'=> [
  27. 'required',
  28. Rule::in( array_map( fn($item)=>$item->value(),MiniprogramType::cases())),
  29. ],
  30. 'appsecret'=>'required|min:30|max:64',
  31. 'appid'=>'required|min:18|max:32',
  32. 'status'=>'in:0,1',
  33. 'pay_merchant_id' => "Integer|gt:0"
  34. ];
  35. }
  36. public function messages(): array
  37. {
  38. return [
  39. 'name.required'=>'小程序名称必填',
  40. 'appid.min'=>'appid太短',
  41. 'appid.max'=>'appid过长',
  42. 'appsecret.min'=>'appsecret太短',
  43. 'appsecret.max'=>'appsecret过长',
  44. "pay_merchant_id" => "支付配置不正确",
  45. ];
  46. }
  47. }