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
I've written a custom filter based on filter_var_array() and inspired by the FilterVars::class to allow an array of repeating arrays (e.g. order lines) to be validated on a per-element level. For example:
This appears to be working fine, but I'm not actually sure how I can apply any of the package's default filters to this kind of 2D array. Ironically, it's brought me back to the original reason I wrote this custom filter; I'm not sure how (or if it's currently possible) to run filter classes on nested array elements?
Thanks for the library, it's ace!
The text was updated successfully, but these errors were encountered:
Hi @ZeroGodForce, sorry for the absurdly late reply. I had not checked this library for a while and for some reason never spotted your comment.
This appears to be working fine, but I'm not actually sure how I can apply any of the package's default filters to this kind of 2D array.
I took a quick a look, and I don't think there is a way to dynamically achieve what you want to do right now; the library does support dot notation, but not wildcard notation, which would be needed here considering the potential variable number of array elements.
You could potentially manually call the sanitizers in your own sanitizer by dynamically passing them in the $fields property though 🤔
I've written a custom filter based on
filter_var_array()
and inspired by theFilterVars::class
to allow an array of repeating arrays (e.g. order lines) to be validated on a per-element level. For example:Then in the form request it's defined like this:
This appears to be working fine, but I'm not actually sure how I can apply any of the package's default filters to this kind of 2D array. Ironically, it's brought me back to the original reason I wrote this custom filter; I'm not sure how (or if it's currently possible) to run filter classes on nested array elements?
Thanks for the library, it's ace!
The text was updated successfully, but these errors were encountered: