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
100100 $ customFields ->each (function ($ customField ) use ($ validatedCustomFieldValues ) {
101101 if (array_key_exists ($ customField ->key , $ validatedCustomFieldValues )) {
102102 $ value = $ validatedCustomFieldValues [$ customField ->key ];
103- if (is_null ($ value )) {
104- return ;
105- }
106103 $ constraints = [
107104 'custom_field_id ' => $ customField ->id ,
108105 'customizable_type ' => $ this ->getMorphClass (),
109106 'customizable_id ' => $ this ->id
110107 ];
108+ if (is_null ($ value )) {
109+ CustomFieldValue::where ($ constraints )->delete ();
110+ return ;
111+ }
111112 $ values = ['value ' => $ value ];
112113 CustomFieldValue::updateOrCreate ($ constraints , $ values );
113114 }
You can’t perform that action at this time.
0 commit comments