Add support for nested block validation#2638
Open
antonioribeiro wants to merge 7 commits into
Open
Conversation
Member
|
Awesome @antonioribeiro. I'd like to merge this, but the tests are showing that this broke the blocks list command, as it is trying to render the new property you added here. |
d0c5edd to
05f2865
Compare
Member
Author
|
Hey ifox, tests pass locally, but manually running the command did give me that error. I just removed the messages from the list, did some other testing here and it seems all good. Waiting for the tests to finishing running on Github |
05f2865 to
3de13f4
Compare
3de13f4 to
f29cb91
Compare
bonroyage
reviewed
Dec 20, 2024
| } | ||
| foreach ($basicRules as $field => $rules) { | ||
| $validator = Validator::make([$field => $formData[$field] ?? null], [$field => $rules]); | ||
| $validator = Validator::make($formData, [$field => $rules], $messages); |
Contributor
There was a problem hiding this comment.
Couldn't we just drop the foreach loop at this point and pass $basicRules directly to the validator?
I just ran into the same issue validating fields and media browsers within a repeater of a block, thought I couldn't be the first and found this PR, so thank you for that 😄
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds support not only to validate neste blocks, but also for custom messages, all to be set within the block.
Here's how it presents itself:
Here's a full block example of it working:
Related Issues
Fixes #1850