designtopack/public/site/plugins/notifications/routes/mark-as-read.php

15 lines
No EOL
365 B
PHP

<?php
return [
'pattern' => '(:all)mark-as-read.json',
'method' => 'POST',
'action' => function () {
$json = file_get_contents('php://input');
$data = json_decode($json);
$user = kirby()->user($data->userUuid);
$newNotifications = $user->readNotification($data->group, $data->notificationId);
return $newNotifications;
}
];