I have a form with a series of numbers in an array:
The accepted answer is ok, and it is working fine, but if you don't want to create function and other stuff then the another workaround which i have used is
that you can directly state the element of array as items.0
and make that input required, it will not care about other inputs but it will make first input required, it is not usable in all the cases but in my case it is useful.
in your OrderCreateRequest
:
public function rules()
{
return [
"items.0" => "required",
];
}
And if your items are not dynamic and not in very large amount then you can use required_without_all
as below:
public function rules()
{
return [
"items.0" => "required_without_all:items.1,items.2",
"items.1" => "required_without_all:items.0,items.2",
"items.2" => "required_without_all:items.0,items.1",
];
}