Replies: 2 comments
-
What do you think about implementation: should i add new method to Arr:: helper, or add third argument to |
Beta Was this translation helpful? Give feedback.
0 replies
-
Tried that with #55491, Taylor didn't like it 🤷🏻♂️ |
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
Uh oh!
There was an error while loading. Please reload this page.
-
💡 Idea: Nested Array Validation Rules for Cleaner Syntax
Hi everyone!
I'd like to propose a small but pretty improvement to Laravel's
Validator
: supporting nested array syntax for validation rules.📌 Problem
Currently, when validating nested arrays - especially with wildcards (
*
) - the rule definitions can become repetitive. For example:As photos properties grow in complexity, managing rules this way gets tedious and error-prone.
✅ Suggested Improvement
I'd like to suggest allowing a more expressive, structured syntax using nested arrays:
Laravel would automatically flatten this into traditional rule keys like
photos.*.name
,photos.*.description
, etc.🔧 Possible Implementation
Flattening these nested rules could be done using a helper similar to
Arr::dot
, but with special handling to ignore list-style arrays and preserve wildcard logic:This would allow Laravel to pre-process rules before validation, making the developer experience much smoother for large arrays.
Beta Was this translation helpful? Give feedback.
All reactions