add nested array validation to form requests

This commit is contained in:
2024-11-09 11:36:16 +03:30
parent fbb4db5e60
commit 117bf0269e
5 changed files with 33 additions and 3 deletions

View File

@@ -24,6 +24,10 @@ class StoreRequest extends FormRequest
return [
'name' => 'required|string',
'fields' => 'required|array',
'fields.*.name' => 'required|string',
'fields.*.unit' => 'string',
'fields.*.type' => 'required|string',
'fields.*.option' => 'string',
];
}
}

View File

@@ -24,6 +24,10 @@ class UpdateRequest extends FormRequest
return [
'name' => 'required|string',
'fields' => 'required|array',
'fields.*.name' => 'required|string',
'fields.*.unit' => 'string',
'fields.*.type' => 'required|string',
'fields.*.option' => 'string',
];
}
}