How to do complex validation on a modal form?
For example, there're 3 integer fields of which the sum should not exceed the number in 4th field?
Illuminate\Contracts\Validation\ValidationRule seems only validate on single attribute, how can I have a validation function that has complete filled data of the form?
Thanks in advance.
5 Replies
Not sure if it works, but I believe the principle is there.
Hi @toeknee thanks for the hint. Injecting $get should work, but seems a little hacky to me.
I was wondering if there exists a validation hook before submitting the form...
I doubt it tbh, you could build your own Laravel Validation where you pass in the values, but you are still getting an eclosure
I just found the HasLifecycleHooks concern, and looks like it suits my need. But still need to find a way to display validation errors since I cannot inject $fail in it's closure..
if you want to display validation messages, you can use