Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[6.x] Fix exclude validation rules for nested data #31006
PR #30835 added the
$request->validate([ 'vehicles.*.type' => 'required|in:car,boat', 'vehicles.*.wheels' => 'exclude_if:vehicles.*.type,boat|required|numeric', ]);
The tests in this PR also contains an example of fields nested 2 levels deep getting included in the validated data, even though they don't have a validation rule. There has been discussion about this bug/feature in the past: laravel/ideas#1993 (comment). This is unrelated to the
This PR came from trying to replicate the weird behavior I encountered while making the original PR (see: #30835 (comment)). I couldn't replicate it, I must have been doing something wrong.