IndexGroupRequest.php 782 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Requests\V3;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. /**
  5. * `GET /v3/groups` 的入参:按名字搜公开团队。
  6. */
  7. class IndexGroupRequest extends FormRequest
  8. {
  9. /**
  10. * 登录与权限在中间件 / Service 里判:authorize() 返回 false 会渲染成 403,
  11. * 而「没登录」应该是 401、「不是成员」要带具体文案。
  12. */
  13. public function authorize(): bool
  14. {
  15. return true;
  16. }
  17. /**
  18. * @return array<string, array<int, mixed>>
  19. */
  20. public function rules(): array
  21. {
  22. return [
  23. 'search' => ['sometimes', 'nullable', 'string', 'max:64'],
  24. 'page' => ['integer', 'min:1'],
  25. 'per_page' => ['integer', 'min:1', 'max:200'],
  26. ];
  27. }
  28. }