read all working

This commit is contained in:
isUnknown 2025-01-15 16:24:34 +01:00
parent 495e1c024e
commit ef09a04b5e
7 changed files with 105 additions and 65 deletions

View file

@ -4,7 +4,20 @@ return [
'pattern' => '(:all)read-all-notifications.json',
'method' => 'GET',
'action' => function () {
$newNotifications = kirby()->user()->readAllNotifications();
return $newNotifications;
$projects = page("projects");
foreach ($projects->children() as $project) {
try {
$project->readAllNotifications();
return json_encode([
"status" => "success"
]);
} catch (\Throwable $th) {
return json_encode([
"status" => "error",
"message" => $th->getMessage() . ' line ' . $th->getLine() . " in file " . $th->getFile()
]);
}
}
}
];