Replies: 4 comments 2 replies
-
In the docs I read someting about the DataAwareRule interface. See |
Beta Was this translation helpful? Give feedback.
-
any updates? i faced the same issue unfortunately 😞 |
Beta Was this translation helpful? Give feedback.
-
Don't know if there is a "correct way". I used Closure. If your attribute is part of an array you gonna get the index on the second position for example:
|
Beta Was this translation helpful? Give feedback.
-
Hello! Myself and @Ross2609 just came across this problem! After lots of source code diving, this can be accomplished with This means that when the validator processes the rule and reaches |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I recently struggled with a problem where I needed to create a custom validation rule, that was dependent on another field's value, for a nested data structure. Unfortunately, the documentation is not very clear how developers can create custom validation rule objects that are dependent on other fields, if at all possible?
The following illustrates the desired "semantic" I was trying to achieve:
I have searched various forums, issues, laracast, ...etc, without any success. I ended up having to use the
addDependentExtensions()
method to add a custom rule. While it worked in my case, I do wonder how the "correct" way of creating dependent rule objects is?Does anyone have a good example of how the above shown example can be achieved?
Beta Was this translation helpful? Give feedback.
All reactions