TestRequest.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace Knuckles\Scribe\Tests\Fixtures;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. /**
  5. * @queryParam location_id required The id of the location.
  6. * @queryParam user_id required The id of the user. Example: me
  7. * @queryParam page required The page number. Example: 4
  8. * @queryParam url_encoded Used for testing that URL parameters will be URL-encoded where needed. Example: + []&=
  9. * @bodyParam user_id int required The id of the user. Example: 9
  10. * @bodyParam room_id string The id of the room.
  11. * @bodyParam forever boolean Whether to ban the user forever. Example: false
  12. * @bodyParam another_one number Just need something here.
  13. * @bodyParam yet_another_param object required
  14. * @bodyParam even_more_param string[]
  15. * @bodyParam book.name string
  16. * @bodyParam book.author_id integer
  17. * @bodyParam book.pages_count integer
  18. * @bodyParam ids integer[]
  19. * @bodyParam users object[] User details
  20. * @bodyParam users[].first_name string The first name of the user. Example: John
  21. * @bodyParam users[].last_name string The last name of the user. Example: Doe
  22. */
  23. class TestRequest extends FormRequest
  24. {
  25. public function rules()
  26. {
  27. return [
  28. 'user_id' => 'int|required',
  29. 'room_id' => ['string'],
  30. 'forever' => 'boolean',
  31. 'no_example_attribute' => 'numeric',
  32. 'another_one' => 'numeric',
  33. 'even_more_param' => 'array',
  34. 'book.name' => 'string',
  35. 'book.author_id' => 'integer',
  36. 'book.pages_count' => 'integer',
  37. 'ids.*' => 'integer',
  38. 'users.*.first_name' => ['string'],
  39. 'users.*.last_name' => 'string',
  40. ];
  41. }
  42. public function bodyParameters()
  43. {
  44. return [
  45. 'user_id' => [
  46. 'description' => 'The id of the user.',
  47. 'example' => 9,
  48. ],
  49. 'room_id' => [
  50. 'description' => 'The id of the room.',
  51. ],
  52. 'forever' => [
  53. 'description' => 'Whether to ban the user forever.',
  54. 'example' => false,
  55. ],
  56. 'another_one' => [
  57. 'description' => 'Just need something here.',
  58. ],
  59. 'no_example_attribute' => [
  60. 'description' => 'Attribute without example.',
  61. 'example' => 'No-example',
  62. ],
  63. 'even_more_param' => [
  64. 'description' => '',
  65. ],
  66. 'book.name' => [
  67. 'description' => '',
  68. ],
  69. 'users.*.first_name' => [
  70. 'description' => 'The first name of the user.',
  71. 'example' => 'John',
  72. ],
  73. 'users.*.last_name' => [
  74. 'description' => 'The last name of the user.',
  75. 'example' => 'Doe',
  76. ],
  77. ];
  78. }
  79. }