Skip to content

Commit

Permalink
Update UserSaveValues.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathologic authored Jul 18, 2024
1 parent 8f58d74 commit 8c3ada1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Services/Users/UserSaveValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,20 @@ function () use ($role) {
$tvs = [];

foreach ($tmplvars as $tmplvar) {
if (isset($this->userData[$tmplvar->name]) && !is_null($this->userData[$tmplvar->name]) && $this->userData[$tmplvar->name] != $tmplvar->default_text) {
if(!isset($this->userData[$tmplvar->name])) continue;
if (!is_null($this->userData[$tmplvar->name]) && $this->userData[$tmplvar->name] != $tmplvar->default_text) {
$tvs['save'][] = ['id' => $tmplvar->id, 'value' => $this->userData[$tmplvar->name]];
} else {
$tvs['delete'][] = $tmplvar->id;
}
}

foreach ($tvs['save'] as $value) {
UserValue::updateOrCreate([
'userid' => $id, 'tmplvarid' => $value['id']
], ['value' => $value['value']]);
if(isset($tvs['save'])) {
foreach ($tvs['save'] as $value) {
UserValue::updateOrCreate([
'userid' => $id, 'tmplvarid' => $value['id']
], ['value' => $value['value']]);
}
}
if(isset($tvs['delete'])) {
UserValue::query()
Expand Down

0 comments on commit 8c3ada1

Please sign in to comment.