You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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