'Laravel request validation with arrays
How can I make a field required if another one is filled?
In html form there is an element product[sale_percent][0] and if it is filled than product[sale_type][0] is required. I have multiple of them and each one is required respectively (for example - [0] for [0], [1] for [1])
In validation rules I've tried
public function rules(): array
{
$modifications = [
...
'product.sale_percent.*' => ['required_with:product.sale_type.*'],
];
But it doesn't work. How can I solve the problem?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
