Hi, I'm trying to validate an array but I don't know if I'm overcomplicating it.
I'm using Inertiajs with Vue, and I'm trying to pass my errors into a component just using :errors="form.errors.ticket[index]" but I can't seem to figure out a way to structure the errors returned from the validator in a way that would make it easy to pass to the component.
By default Laravel will return multidimensional array errors like:
tickets.0.description:"The ticket description is required."
tickets.0.price:"The tickets.0.price field must have 0-2 decimal places."
tickets.1.description:"The ticket description is required."
tickets.1.name:"The ticket name is required."
tickets.1.price:"The tickets.1.price field must have 0-2 decimal places."
is there any way to create a structure like:
tickets: {
0: {
description: "The ticket description is required.",
price:"The tickets.0.price field must have 0-2 decimal places."
},
1: {
description: "The ticket description is required.",
price:"The tickets.1.price field must have 0-2 decimal places."
}
...etc
}