Kaynağa Gözat

wip: fix null $existingRecord

3.x
wallo 2 yıl önce
ebeveyn
işleme
6363c73454

+ 5
- 0
app/Traits/HandlesDefaultSettingRecordCreation.php Dosyayı Görüntüle

@@ -28,6 +28,11 @@ trait HandlesDefaultSettingRecordCreation
28 28
         foreach ($relatedEntities as $field => $params) {
29 29
             [$class, $key, $type] = array_pad($params, 3, null);
30 30
 
31
+            if ($existingRecord === null || !isset($existingRecord->{$field})) {
32
+                $newData[$field] = $data[$field];
33
+                continue;
34
+            }
35
+
31 36
             if (isset($data[$field]) && $data[$field] !== $existingRecord->{$field}) {
32 37
                 $this->updateEnabledRecord($class, $key, $existingRecord->{$field}, $type, false);
33 38
                 $this->updateEnabledRecord($class, $key, $data[$field], $type, true);

Loading…
İptal
Kaydet