File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -100,14 +100,15 @@ public function saveCustomFieldValues(): void
100
100
$ customFields ->each (function ($ customField ) use ($ validatedCustomFieldValues ) {
101
101
if (array_key_exists ($ customField ->key , $ validatedCustomFieldValues )) {
102
102
$ value = $ validatedCustomFieldValues [$ customField ->key ];
103
- if (is_null ($ value )) {
104
- return ;
105
- }
106
103
$ constraints = [
107
104
'custom_field_id ' => $ customField ->id ,
108
105
'customizable_type ' => $ this ->getMorphClass (),
109
106
'customizable_id ' => $ this ->id
110
107
];
108
+ if (is_null ($ value )) {
109
+ CustomFieldValue::where ($ constraints )->delete ();
110
+ return ;
111
+ }
111
112
$ values = ['value ' => $ value ];
112
113
CustomFieldValue::updateOrCreate ($ constraints , $ values );
113
114
}
You can’t perform that action at this time.
0 commit comments