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
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+ }
103106 $ constraints = [
104107 'custom_field_id ' => $ customField ->id ,
105108 'customizable_type ' => $ this ->getMorphClass (),
@@ -117,6 +120,10 @@ public function saveCustomFieldValues(): void
117120 public function loadCustomFieldValues (): void
118121 {
119122 if ($ this ->customFieldValues ->isEmpty ()) {
123+ $ this ->getCustomFields ()->each (function (CustomField $ customField ) {
124+ $ attribute = "custom_ {$ customField ->key }" ;
125+ $ this ->setAttribute ($ attribute , $ customField ->default_value );
126+ });
120127 return ;
121128 }
122129
You can’t perform that action at this time.
0 commit comments