mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 00:25:18 +00:00
Added a method to delete notifications.
This commit is contained in:
@ -54,6 +54,30 @@ class notificationComponent {
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the informations about a single notification
|
||||
*
|
||||
* @param int $notifID The target notification ID
|
||||
* @return Notification The target notification
|
||||
*/
|
||||
public function get_single(int $notifID) : Notification {
|
||||
|
||||
//Perform database request
|
||||
$conditions = "WHERE id = ?";
|
||||
$values = array($notifID);
|
||||
|
||||
//Perform the request
|
||||
$result = CS::get()->db->select(self::NOTIFICATIONS_TABLE, $conditions, $values);
|
||||
|
||||
//Check for error
|
||||
if(count($result) == 0)
|
||||
return new Notification(); //Return empty notification
|
||||
|
||||
//Parse and return notification
|
||||
return $this->dbToNotification($result[0]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a new notification
|
||||
*
|
||||
|
Reference in New Issue
Block a user