Replies: 1 comment
-
In hindsight, I think the better solution is to simply prepare the query string input before it hits the validator, this would align better with input from alternative methods (eg. a json body) which would already be typed appropriately. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently all request input (from a query string) is handled as strings. If I am using a validation rule such as
boolean
it would be pretty nice if the validated input value was cast to a boolean for me.There are existing methods on the request that allow me to pluck individual inputs with a specified type eg.
$request->boolean('field_name')
. However, no current way I know of getting all validated input cast to strict types.In terms of implementation, feels to me like this is focussed around the request and not necessarily the validator itself (the validator will happily return whatever type the given data is).
Perhaps a new method something like
$request->validatedStrictTypes()
would use the rules to cast each input value. What do people think, worth pursing?Beta Was this translation helpful? Give feedback.
All reactions