IndexAdminAgentRunRequest.php 1004 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Http\Requests\V3;
  3. use App\Models\AgentRun;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. use Illuminate\Validation\Rule;
  6. /**
  7. * `GET /v3/admin/agent-runs` 的入参:管理员查阅提问列表。
  8. */
  9. class IndexAdminAgentRunRequest extends FormRequest
  10. {
  11. public function authorize(): bool
  12. {
  13. return true;
  14. }
  15. /**
  16. * @return array<string, array<int, mixed>>
  17. */
  18. public function rules(): array
  19. {
  20. return [
  21. 'filter.status' => ['sometimes', Rule::in(AgentRun::STATUSES)],
  22. 'filter.route' => ['sometimes', Rule::in(AgentRun::ROUTES)],
  23. 'filter.account_type' => ['sometimes', 'in:user,guest'],
  24. 'filter.client' => ['sometimes', 'in:mobile,web'],
  25. 'filter.improve' => ['sometimes', 'in:true,false,1,0'],
  26. 'filter.q' => ['sometimes', 'string', 'max:200'],
  27. 'page' => ['integer', 'min:1'],
  28. 'per_page' => ['integer', 'min:1', 'max:100'],
  29. ];
  30. }
  31. }