SummaryDiscussionRequest.php 719 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Requests\V3;
  3. use App\Models\Discussion;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. use Illuminate\Validation\Rule;
  6. /**
  7. * `GET /v3/discussions/summary` 的入参:某个对象上的话题概况。
  8. */
  9. class SummaryDiscussionRequest 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. 'target_type' => ['required', 'string', Rule::in(Discussion::TARGET_TYPES)],
  22. 'target_id' => ['required', 'uuid'],
  23. 'type' => ['sometimes', 'string', Rule::in(Discussion::COMMENT_TYPES)],
  24. ];
  25. }
  26. }