StoreAgentGrantRequest.php 826 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Requests\V3;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. use Illuminate\Validation\Rule;
  5. /**
  6. * `POST /v3/agent-grants` 的入参:给哪个模型、在哪个 channel(可限 book)上授权。
  7. *
  8. * 目前只有 channel 一种范围:句子、逐词、句子上的批注都落在 channel 里。
  9. */
  10. class StoreAgentGrantRequest extends FormRequest
  11. {
  12. public function authorize(): bool
  13. {
  14. return true;
  15. }
  16. /**
  17. * @return array<string, array<int, mixed>>
  18. */
  19. public function rules(): array
  20. {
  21. return [
  22. 'ai_model' => ['required', 'uuid'],
  23. 'target_type' => ['required', 'string', Rule::in(['channel'])],
  24. 'target_id' => ['required', 'uuid'],
  25. 'book' => ['sometimes', 'integer', 'min:0'],
  26. ];
  27. }
  28. }