Can get the number of unread notifications

This commit is contained in:
Pierre
2018-02-18 18:57:19 +01:00
parent abecb78111
commit b9406731a4
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,30 @@
<?php
/**
* Notifications REST controller
*
* @author Pierre HUBERT
*/
class notificationsController {
/**
* Get the number of unread notifications of a user
*
* @url POST notifications/count_unread
*/
public function count_unread(){
user_login_required();
//Get the number of unread notifications
$number = components()->notifications->count_unread(userID);
//Return it
return array(
"number" => $number
);
}
}