Skip to content

Commit

Permalink
refactor saving tvs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathologic committed Jul 17, 2024
1 parent c91bf86 commit 6da322e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Services/Documents/DocumentCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,17 @@ function () {
public function saveTVs()
{
foreach ($this->tvs['save'] as $value) {
\EvolutionCMS\Models\SiteTmplvarContentvalue::updateOrCreate([
SiteTmplvarContentvalue::updateOrCreate([
'contentid' => $this->documentData['id'], 'tmplvarid' => $value['id']
], ['value' => $value['value']]);
}
if($this->mode == 'edit' && $this->tvs['delete']) {
\EvolutionCMS\Models\SiteTmplvarContentvalue::query()
if($this->mode == 'edit' && isset($this->tvs['delete'])) {
SiteTmplvarContentvalue::query()
->whereIn('tmplvarid', $this->tvs['delete'])
->where('contentid', $this->documentData['id'])
->delete();
}
$this->tvs = [];
}

public function updateParent()
Expand Down

0 comments on commit 6da322e

Please sign in to comment.