beertastic
1 week ago
107
2
Laravel

Validation across multiple inputs, combined?

Posted 1 week ago by beertastic

I have 5 input boxes that all need to equal to 100 on validation.

<input name="percent[]" value="">
<input name="percent[]" value="">
<input name="percent[]" value="">
<input name="percent[]" value="">
<input name="percent[]" value="">

How can I validate to make sure that the TOTAL value of percent.. is 100.. no higher, no lower?

I've created a new rule:

artisan make:rule percent100

But I'm stumped as to what to put in it?

Please sign in or create an account to participate in this conversation.