IndexAdminAgentDigestRequest.php 908 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Http\Requests\V3;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. /**
  5. * `GET /v3/admin/agent-runs/digest` 的入参:分析用的精简导出。
  6. */
  7. class IndexAdminAgentDigestRequest extends FormRequest
  8. {
  9. public const MAX_LIMIT = 2000;
  10. /** 带回答与证据全文时每条可达几万字,上限收紧 */
  11. public const MAX_LIMIT_FULL = 200;
  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. 'from' => ['sometimes', 'date_format:Y-m-d'],
  23. 'to' => ['sometimes', 'date_format:Y-m-d', 'after_or_equal:from'],
  24. 'full' => ['sometimes', 'boolean'],
  25. 'limit' => ['sometimes', 'integer', 'min:1', 'max:'.($this->boolean('full') ? self::MAX_LIMIT_FULL : self::MAX_LIMIT)],
  26. ];
  27. }
  28. }