TestRequest.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. 'another_one' => 'numeric',
  32. 'even_more_param' => 'array',
  33. 'book.name' => 'string',
  34. 'book.author_id' => 'integer',
  35. 'book.pages_count' => 'integer',
  36. 'ids.*' => 'integer',
  37. 'users.*.first_name' => ['string'],
  38. 'users.*.last_name' => 'string',
  39. ];
  40. }
  41. public function bodyParameters()
  42. {
  43. return [
  44. 'user_id' => [
  45. 'description' => 'The id of the user.',
  46. 'example' => 9,
  47. ],
  48. 'room_id' => [
  49. 'description' => 'The id of the room.',
  50. ],
  51. 'forever' => [
  52. 'description' => 'Whether to ban the user forever.',
  53. 'example' => false,
  54. ],
  55. 'another_one' => [
  56. 'description' => 'Just need something here.',
  57. ],
  58. 'even_more_param' => [
  59. 'description' => '',
  60. ],
  61. 'book.name' => [
  62. 'description' => '',
  63. ],
  64. 'users.*.first_name' => [
  65. 'description' => 'The first name of the user.',
  66. 'example' => 'John',
  67. ],
  68. 'users.*.last_name' => [
  69. 'description' => 'The last name of the user.',
  70. 'example' => 'Doe',
  71. ],
  72. ];
  73. }
  74. }