add / readNotification working
This commit is contained in:
parent
722c6b198e
commit
ed73b33234
6 changed files with 159 additions and 20 deletions
|
|
@ -13,6 +13,9 @@ Kirby::plugin('adrienpayet/pdc-user-methods', [
|
|||
$notifications[$group] = [];
|
||||
}
|
||||
|
||||
|
||||
$data['isRead'] = false;
|
||||
|
||||
$notifications[$group][$data['id']] = $data;
|
||||
|
||||
$otherUser->update([
|
||||
|
|
@ -22,6 +25,20 @@ Kirby::plugin('adrienpayet/pdc-user-methods', [
|
|||
throw new Exception("Error updating notifications: " . $th->getMessage() . ' line ' . $th->getLine(), 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
'readNotification' => function ($group, $notificationId) {
|
||||
$notifications = Yaml::decode($this->notifications()->value());
|
||||
|
||||
try {
|
||||
$notifications[$group][$notificationId]['isRead'] = true;
|
||||
} catch (\Throwable $th) {
|
||||
//throw $th;
|
||||
}
|
||||
|
||||
$this->update([
|
||||
"notifications" => $notifications
|
||||
]);
|
||||
return $notifications;
|
||||
}
|
||||
]
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue