TestRequest.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Knuckles\Scribe\Tests\Fixtures;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. use Knuckles\Scribe\Extracting\BodyParam;
  5. /**
  6. * @queryParam location_id required The id of the location.
  7. * @queryParam user_id required The id of the user. Example: me
  8. * @queryParam page required The page number. Example: 4
  9. * @queryParam filters.* The filters.
  10. * @queryParam url_encoded Used for testing that URL parameters will be URL-encoded where needed. Example: + []&=
  11. * @bodyParam user_id int required The id of the user. Example: 9
  12. * @bodyParam room_id string The id of the room.
  13. * @bodyParam forever boolean Whether to ban the user forever. Example: false
  14. * @bodyParam another_one number Just need something here.
  15. * @bodyParam yet_another_param object required
  16. * @bodyParam even_more_param array
  17. * @bodyParam book.name string
  18. * @bodyParam book.author_id integer
  19. * @bodyParam book[pages_count] integer
  20. * @bodyParam ids.* integer
  21. * @bodyParam users.*.first_name string The first name of the user. Example: John
  22. * @bodyParam users.*.last_name string The last name of the user. Example: Doe
  23. */
  24. class TestRequest extends FormRequest
  25. {
  26. public function rules()
  27. {
  28. return [
  29. 'user_id' => BodyParam::description('The id of the user.')
  30. ->example(9)->rules('int|required'),
  31. 'room_id' => BodyParam::description('The id of the room.')->rules(['string']),
  32. 'forever' => BodyParam::description('Whether to ban the user forever.')
  33. ->example(false)->rules('boolean'),
  34. 'another_one' => BodyParam::description('Just need something here.')->rules('numeric'),
  35. 'even_more_param' => BodyParam::description('')->rules('array'),
  36. 'book.name' => BodyParam::description('')->rules('string'),
  37. 'book.author_id' => BodyParam::description()->rules('integer'),
  38. 'book[pages_count]' => BodyParam::description()->rules('integer'),
  39. 'ids.*' => BodyParam::description()->rules('integer'),
  40. 'users.*.first_name' => BodyParam::description('The first name of the user.')->example('John')->rules(['string']),
  41. 'users.*.last_name' => BodyParam::description('The last name of the user.')->example('Doe')->rules('string'),
  42. 'gets_ignored' => 'string',
  43. ];
  44. }
  45. }