Skip to content

Commit 0205411

Browse files
If no custom field response found, continue
1 parent 9b7b9ee commit 0205411

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Traits/HasCustomFieldResponses.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ public function customFieldResponses()
1515
public function saveCustomFields($fields)
1616
{
1717
foreach ($fields as $key => $value) {
18+
$customField = CustomField::find((int) $key);
19+
20+
if (!$customField) {
21+
continue;
22+
}
23+
1824
CustomFieldResponse::create([
1925
'value' => $value,
20-
'field_id' => CustomField::find((int) $key)->id,
26+
'field_id' => $customField->id,
2127
'model_id' => $this->id,
2228
'model_type' => get_class($this),
2329
]);

0 commit comments

Comments
 (0)