How to validate array in Request rules laravel?
Based on your json
you can do something like below
public function rules()
{
return [
'name' => 'required',
'dial_number' => 'required',
'phone_number' => 'required|array',
'phone_number.number' => 'required|regex:/(^[0-9 ]+$)+/',
'phone_number.internationalNumber' => 'required|regex:/(^[0-9 ]+$)+/',
'phone_number.nationalNumber' => 'required|regex:/(^[0-9 ]+$)+/',
'phone_number.e164Number' => 'required',
'phone_number.countryCode' => 'required|string',
'phone_number.countryCode' => 'required|string',
'phone_number.dialCode' => 'required',
//'image' => 'required',
];
}
for more info you can visit laravel documentation