While working on a new Laravel Application, I needed a solution for multi-entry validation: Users should be able to add one or many persons to an event and the input should still be validated.
Laravels standard validation approach is based on static rules and messages to validate forms and/or to save models ## Prerequiste – setting up the form
The dynamic validation requires that the form entries follow the pattern Input[key][field], for instance:
I actually used UUIDs as keys that were dynamically created via Javascript (see Stackoverflow) when a new person was added.
Validation
Before the validation is called, the rules are dynamically defined based on the data array (here using the Laravel dot-Notation):