P粉1292756582023-08-09 11:40:37
Personally, in another ProductPriceRequest class, I would not try to reuse the same rules; for ProductRequest, I would just do something similar
'prices.*.name' => ['required', 'min:3'], 'prices.*.id' => ['numeric'],
Or whatever your rules are.
Technically if you really want to use the same rules you could put these duplicate rules in the ProductPrice model and then use them in both FormRequest files, but I'm not sure yet There would be other conflicts, because here, the data is in the form of an array, while in another case (you didn't show elsewhere that you use and require ProductPriceRequest), another structure for validation may be passed