GetAuthUrlRequest.php 912 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Http\Requests\Client\Wechat;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class GetAuthUrlRequest extends FormRequest
  5. {
  6. /**
  7. * Determine if the user is authorized to make this request.
  8. */
  9. public function authorize(): bool
  10. {
  11. return true;
  12. }
  13. /**
  14. * Get the validation rules that apply to the request.
  15. *
  16. * @return array<string, array<int, string>>
  17. */
  18. public function rules(): array
  19. {
  20. return [
  21. 'redirect_uri' => ['required', 'url'],
  22. 'scope' => ['nullable', 'string', 'in:snsapi_base,snsapi_userinfo'],
  23. ];
  24. }
  25. /**
  26. * Get custom attributes for validator errors.
  27. *
  28. * @return array<string, string>
  29. */
  30. public function attributes(): array
  31. {
  32. return [
  33. 'redirect_uri' => '回调地址',
  34. 'scope' => '授权范围',
  35. ];
  36. }
  37. }