Lost with Rules and ValidationRule #389
-
Hi, I am a little bit lost with how to use custom validation rules. This is my class:
in order to be able to validate the vote, I need data from the meeting. How can I pass the "meeting" input to the new ValidateVotes() rule? Kind regards Andries ps: this is the 3rd time I write a question about the framework, the previous 2 times I found the solution by just typing the question here, so I didn't have to submit. Despite the fact that this is a very good rubber duck, it didn't help this time... pps: I also don't full understand the different between using a ValidationRule to validate, or using the Rule( new CustomRule ) way... |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I was able to get it to work by not working with Attributes, but with the rules function. Is it possible to achieve the same via #[Rule(new ValidateVotes())] ?
|
Beta Was this translation helpful? Give feedback.
-
I don't think there's another option at the moment to achieve this. So the |
Beta Was this translation helpful? Give feedback.
-
Thanks Ruben for your reply! I will go for this now. But one way or another other validation rules like "before" etc are able to fetch these other attributes, but I can't get my head around on how that actually works... but for now, it is all good! |
Beta Was this translation helpful? Give feedback.
I don't think there's another option at the moment to achieve this. So the
rules
method is the way to go!