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 40668b3 commit 8f58d74
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Services/Users/UserSaveValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ function () use ($role) {
->join('site_tmplvars', 'site_tmplvars.id', '=', 'user_role_vars.tmplvarid')->get();
});
});
$tvs = [
'save' => [],
'delete' => []
];
$tvs = [];

foreach ($tmplvars as $tmplvar) {
if (isset($this->userData[$tmplvar->name]) && !is_null($this->userData[$tmplvar->name]) && $this->userData[$tmplvar->name] != $tmplvar->default_text) {
Expand All @@ -128,7 +125,7 @@ function () use ($role) {
'userid' => $id, 'tmplvarid' => $value['id']
], ['value' => $value['value']]);
}
if($tvs['delete']) {
if(isset($tvs['delete'])) {
UserValue::query()
->whereIn('tmplvarid', $tvs['delete'])
->where('userid', $id)
Expand Down

0 comments on commit 8f58d74

Please sign in to comment.