mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-03 20:57:19 -06:00
Fix for #2049
This commit is contained in:
parent
1fc2c998de
commit
25b2b43a38
@ -216,8 +216,22 @@ class Preferences
|
||||
{
|
||||
$fullName = sprintf('preference%s%s', $user->id, $name);
|
||||
Cache::forget($fullName);
|
||||
/** @var Preference $pref */
|
||||
$pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);
|
||||
|
||||
if (null !== $pref && null === $value) {
|
||||
try {
|
||||
$pref->delete();
|
||||
} catch (Exception $e) {
|
||||
Log::error(sprintf('Could not delete preference: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
return new Preference;
|
||||
}
|
||||
if (null === $value) {
|
||||
return new Preference;
|
||||
}
|
||||
|
||||
if (null !== $pref) {
|
||||
$pref->data = $value;
|
||||
$pref->save();
|
||||
|
Loading…
Reference in New Issue
Block a user