Fix validation select issue

This commit is contained in:
Julien Nahum 2023-12-18 10:52:29 +01:00
parent 5ee599fba5
commit f3e4dcd272
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class AnswerFormRequest extends FormRequest
if(isset($data[$field['id']]) && is_array($data[$field['id']])){
$data[$field['id']] = array_map(function ($val) use ($field) {
$tmpop = collect($field[$field['type']]['options'])->first(function ($op) use ($val) {
return ($op['id'] === $val);
return ($op['id'] ?? $op['value'] === $val);
});
return isset($tmpop['name']) ? $tmpop['name'] : "";
}, $data[$field['id']]);