I have a form with these inputs: name
, height
, weight
and mobilenumbers[]
(this is an array)
for example: mobilenumbers
[12345678,88665544,45456574,33669988]
The user can dynamically add more fields of "mobilenumbers". I need to validate the array of "mobilenumbers". How do i do that? Laravel documentation is quite confusing. whether i need to write custom validation in AppServiceProvider or can i simply validate each data in the array? in laravel 5.4 documentation it says something like:
$validator = Validator::make($request->all(), [
'person.*.email' => 'email|unique:users',
'person.*.first_name' => 'required_with:person.*.last_name',
]);
but in my case my array is simply mobilenumbers[], how do i do that?
Thanks a lot in advance