TestRequest.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 array
  15. * @bodyParam book.name string
  16. * @bodyParam book.author_id integer
  17. * @bodyParam book[pages_count] integer
  18. * @bodyParam ids.* integer
  19. * @bodyParam users.*.first_name string The first name of the user. Example: John
  20. * @bodyParam users.*.last_name string The last name of the user. Example: Doe
  21. */
  22. class TestRequest extends FormRequest
  23. {
  24. public function rules()
  25. {
  26. return [
  27. 'user_id' => 'int|required',
  28. 'room_id' => ['string'],
  29. 'forever' => 'boolean',
  30. 'another_one' => 'numeric',
  31. 'even_more_param' => 'array',
  32. 'book.name' => 'string',
  33. 'book.author_id' => 'integer',
  34. 'book[pages_count]' => 'integer',
  35. 'ids.*' => 'integer',
  36. 'users.*.first_name' => ['string'],
  37. 'users.*.last_name' => 'string',
  38. ];
  39. }
  40. public function bodyParameters()
  41. {
  42. return [
  43. 'user_id' => [
  44. 'description' => 'The id of the user.',
  45. 'example' => 9,
  46. ],
  47. 'room_id' => [
  48. 'description' => 'The id of the room.',
  49. ],
  50. 'forever' => [
  51. 'description' => 'Whether to ban the user forever.',
  52. 'example' => false,
  53. ],
  54. 'another_one' => [
  55. 'description' => 'Just need something here.',
  56. ],
  57. 'even_more_param' => [
  58. 'description' => '',
  59. ],
  60. 'book.name' => [
  61. 'description' => '',
  62. ],
  63. 'users.*.first_name' => [
  64. 'description' => 'The first name of the user.',
  65. 'example' => 'John',
  66. ],
  67. 'users.*.last_name' => [
  68. 'description' => 'The last name of the user.',
  69. 'example' => 'Doe',
  70. ],
  71. ];
  72. }
  73. }