Closed lucraraujo closed 3 years ago
Hey,
you can use the asterisk to achieve this.
$request->validate([
'many_foo' => ['required', 'array'],
'many_foo.*' => [new EnumRule(FooEnum::class)],
]);
@Gummibeer Thanks man! It worked! Sorry if a opened this issue on the wrong place, since my problem was a lack of knowledge on Laravel validation. Thanks a lot!
I have a list os value that I have encapsulated as enum. It's something like this:
And I can select one or more os theses values, I'm trying to validade if in the values I receive in the controller are valid. The array I receive is something like this:
And my validation is something like this: