I'm trying to create validation for following request - data that is passed to given endpoint needs to be an array of arrays, where each inner array contains line1 and postcode and the size of the outer array is min:1. So, for example:
[
['line1' => 'foo', 'postcode' => 'bar'],
['line1' => 'baz', 'postcode' => 'qux']
]
is a valid data for my request and:
[
['line1' => 'foo', 'postcode' => 'bar'],
['line1' => 'baz']
]
is not.
I've created a Request validation class with following rules:
public function rules()
{
return [
'*.line1' => 'string|required',
'*.postcode' => 'string|required',
];
}
however I don't know how to add the min requirement. Neither '*' => 'min:1', nor '' => 'min:1' work (I'd think that first one should theoretically work, but I think it checks for length of each field to be 1)