Imaging having the following input for a form request validation.
[
'relations' =>
[
[
'primary' => true,
],
[
'primary' => false,
],
],
],
Is there any validation that makes it possible to secure that at least one of the relations models have primary set to true? More perfect if it could secure only one element is true. This problem seems like it could have existed before.
So if we only see the input for relations, this should pass.
[
'primary' => true,
],
[
'primary' => false,
],
This should fail in validation.
[
'primary' => false,
],
[
'primary' => false,
],