Request method propagation #602
Replies: 3 comments 7 replies
-
@m4tthumphrey Can you please show some examples of your real route's methods and what is your expected ideal API documentation? I kind of get what you're asking about, but not 100% sure |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply! Controller looks like this. The doc should mention query params:
public function venues(Request $request): AnonymousResourceCollection
{
$countryId = $request->integer('country');
$venues = Venue::with('destination:id,name,iata_code,country_id')
->where('name', '<>','')
->when($countryId, fn ($query) => $query->whereHas('destination', fn ($query) => $query->whereCountryId($countryId)));
$paginated = $this->paginated($venues, $request, ['id', 'name', 'address', 'description', 'coordinates', 'img_stadium', 'img_categories', 'destination_id']);
return VenueResource::collection($paginated);
} |
Beta Was this translation helpful? Give feedback.
-
Please let me know if a need to create an issue for this but constants do not seem to work when using
It just treats it as blank. I think this code is handled vendor/dedoc/scramble/src/Support/Type/Literal/LiteralIntegerType.php but as I said before I do not know enough bout reflection, yet. |
Beta Was this translation helpful? Give feedback.
-
Hello, great library, I am really enjoying using it!
I love the "Method calls on a request object" functionality however it doesn't lend well to reusability, that is
$request->get()
has to be called explicitly within the route scope (ie controller method etc). I am trying to reuse as much of the pagination code in my app as possible as per the example below.As you can see, I only need to call
$request->integer('page.size', self::DEFAULT_SIZE)
and$request->integer('page.number', 1)
once for every route that I want to use this functionality from this trait. This does not seem to compatible with Scramble.Now I do not know enough about Reflection in PHP (yet) but I'm wondering if this could evolve into a feature or if it simple isn't possible? If its the latter I can move on swiftly but if there is some chance it could work eventually, I would be fine to repeat myself until such a time it's available.
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions