ChannelBatchProgressRequest.php 843 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Requests\V3;
  3. use App\Services\V3\ChannelProgressService;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. /**
  6. * `POST /v3/channels/batch-progress` 的入参:一批句子 id,可选只看某个 studio 名下的。
  7. */
  8. class ChannelBatchProgressRequest extends FormRequest
  9. {
  10. /**
  11. * 登录与权限在 Service 里判:未登录也能查(只看得到公开的)。
  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. 'sentences' => ['required', 'array', 'min:1', 'max:'.ChannelProgressService::MAX_SENTENCES],
  24. 'sentences.*' => ['string', 'regex:/^\d+-\d+-\d+-\d+$/'],
  25. 'studio' => ['sometimes', 'uuid'],
  26. ];
  27. }
  28. }