IndexTipitakaChannelRequest.php 793 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Http\Requests\V3;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. use Illuminate\Validation\Rule;
  5. /**
  6. * `GET /v3/tipitaka-channels` 的入参:有译文的公开 channel 目录。
  7. */
  8. class IndexTipitakaChannelRequest extends FormRequest
  9. {
  10. public function authorize(): bool
  11. {
  12. return true;
  13. }
  14. /**
  15. * @return array<string, array<int, mixed>>
  16. */
  17. public function rules(): array
  18. {
  19. return [
  20. 'type' => ['sometimes', 'string', Rule::in(IndexChannelRequest::TYPES)],
  21. 'lang' => ['sometimes', 'string', 'max:16'],
  22. 'min_progress' => ['sometimes', 'numeric', 'min:0', 'max:1'],
  23. 'page' => ['integer', 'min:1'],
  24. 'per_page' => ['integer', 'min:1', 'max:200'],
  25. ];
  26. }
  27. }