Skip to content

Commit 34e450c

Browse files
authored
Merge pull request #581 from bakaphp/hotfix-apps-settings-update
Change ->model for on setSettings function call
2 parents a461ec5 + d199a6a commit 34e450c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Api/Controllers/AppsController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ protected function processEdit(RequestInterface $request, ModelInterface $record
101101
{
102102
//process the input
103103
$request = $this->processInput($request->getPutData());
104-
105104
if (array_key_exists('settings', $request) && isJson($request['settings'])) {
106-
$this->model->setSettings(json_decode($request['settings'], true));
105+
$record->setSettings(json_decode($request['settings'], true));
107106
}
108107

109108
$record->updateOrFail($request, $this->updateFields);

src/Models/Apps.php

+12
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ public function afterCreate() : void
118118
JobsApps::dispatch($this);
119119
}
120120

121+
/**
122+
* After Update function.
123+
*
124+
* @return void
125+
*/
126+
public function afterUpdate() : void
127+
{
128+
foreach ($this->settings as $key => $value) {
129+
$this->set($key, $value);
130+
}
131+
}
132+
121133
/**
122134
* Sets Apps settings.
123135
*

0 commit comments

Comments
 (0)