add notifications plugin + created reply comment route
This commit is contained in:
parent
b332c6d871
commit
c3860d4a38
6 changed files with 53 additions and 5 deletions
7
public/site/plugins/notifications/index.php
Normal file
7
public/site/plugins/notifications/index.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
Kirby::plugin('adrienpayet/pdc-notifications', [
|
||||
'routes' => [
|
||||
require(__DIR__ . '/routes/mark-as-read.php'),
|
||||
]
|
||||
]);
|
||||
15
public/site/plugins/notifications/routes/mark-as-read.php
Normal file
15
public/site/plugins/notifications/routes/mark-as-read.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?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;
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue