StoreMarkupPreviewRequest.php 775 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Requests\V3;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. /**
  5. * `POST /v3/markup-previews`:要预览的源码与渲染口径。
  6. */
  7. class StoreMarkupPreviewRequest extends FormRequest
  8. {
  9. public function authorize(): bool
  10. {
  11. return true;
  12. }
  13. /**
  14. * @return array<string, array<int, mixed>>
  15. */
  16. public function rules(): array
  17. {
  18. return [
  19. 'content' => ['required', 'string', 'max:20000'],
  20. 'content_type' => ['sometimes', 'string', 'in:markdown,markdown-e2'],
  21. 'channels' => ['sometimes', 'array', 'max:10'],
  22. 'channels.*' => ['uuid'],
  23. 'lang' => ['sometimes', 'string', 'max:16', 'regex:/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/'],
  24. ];
  25. }
  26. }