mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Can get the number of unread notifications
This commit is contained in:
		
							
								
								
									
										30
									
								
								RestControllers/notificationsController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								RestControllers/notificationsController.php
									
									
									
									
									
										Normal 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
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user