File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,9 @@ 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
+ }
103
106
$ constraints = [
104
107
'custom_field_id ' => $ customField ->id ,
105
108
'customizable_type ' => $ this ->getMorphClass (),
@@ -117,6 +120,10 @@ public function saveCustomFieldValues(): void
117
120
public function loadCustomFieldValues (): void
118
121
{
119
122
if ($ this ->customFieldValues ->isEmpty ()) {
123
+ $ this ->getCustomFields ()->each (function (CustomField $ customField ) {
124
+ $ attribute = "custom_ {$ customField ->key }" ;
125
+ $ this ->setAttribute ($ attribute , $ customField ->default_value );
126
+ });
120
127
return ;
121
128
}
122
129
You can’t perform that action at this time.
0 commit comments