AggregateTipitakaRelatedParagraphRequest.php 974 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Http\Requests\V3;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. /**
  5. * `GET /v3/tipitaka-related-paragraphs/aggregate` 的入参:列出所有 SC 缩写。
  6. *
  7. * 过滤器沿用 wikipali 的坐标命名:`file` 是典籍文件号(表里的 `book` 列,
  8. * 1-217),`book` 是真书号(表里的 `book_id` 列)。其余参数是可选收窄过滤器;
  9. * 分页走 Laravel 默认的 page / per_page。
  10. */
  11. class AggregateTipitakaRelatedParagraphRequest extends FormRequest
  12. {
  13. /**
  14. * 公共只读端点,不需要登录。
  15. */
  16. public function authorize(): bool
  17. {
  18. return true;
  19. }
  20. /**
  21. * @return array<string, array<int, mixed>>
  22. */
  23. public function rules(): array
  24. {
  25. return [
  26. 'file' => ['integer', 'min:1'],
  27. 'book' => ['integer', 'min:1'],
  28. 'page' => ['integer', 'min:1'],
  29. 'per_page' => ['integer', 'min:1', 'max:200'],
  30. ];
  31. }
  32. }