From 49db639591db035a559d45ce08c0220f4856727b Mon Sep 17 00:00:00 2001 From: Pathologic Date: Thu, 18 Jul 2024 11:36:02 +0300 Subject: [PATCH] Update DocumentCreate.php --- src/Services/Documents/DocumentCreate.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Services/Documents/DocumentCreate.php b/src/Services/Documents/DocumentCreate.php index 356d87b..3943cff 100644 --- a/src/Services/Documents/DocumentCreate.php +++ b/src/Services/Documents/DocumentCreate.php @@ -323,10 +323,12 @@ function () { public function saveTVs() { - foreach ($this->tvs['save'] as $value) { - SiteTmplvarContentvalue::updateOrCreate([ - 'contentid' => $this->documentData['id'], 'tmplvarid' => $value['id'] - ], ['value' => $value['value']]); + if(isset($this->tvs['save'])) { + foreach ($this->tvs['save'] as $value) { + SiteTmplvarContentvalue::updateOrCreate([ + 'contentid' => $this->documentData['id'], 'tmplvarid' => $value['id'] + ], ['value' => $value['value']]); + } } if($this->mode == 'edit' && isset($this->tvs['delete'])) { SiteTmplvarContentvalue::query()