You'd need to make a rule for it so that the error message can show if there is one. If there isn't a rule for it, the error message for that rule would never get triggered since it didn't actually run through validation, so it can't fail the validation which creates the errors.
$this->validate($request, [
'participant.*.name' => 'required|string',
'participant.*.surname' => 'required|string',
'participant_question.*.required' => 'required'
]);
additionally, this doesn't make sense
foreach ($request->participant_question_required as $key => $value) {
if ($value) {
$this->validate($request, [
'participant.*.answer' => 'required',
]);
}
}
You're adding the exact same rule over and over, which uses a *, which means it only needs to be added once since * means for all participant[]answers, not an individual one.
If you're trying to target specific elements in the array, then you'd add the index ($key) to the rule instead of *.
"participant.{$key}.answer" => 'required',