I want to make a system of notifications that group together when they are the same type, as those of Facebook. For now I have the table with the following columns:
user_id (person receiving notification),
icon (Generally the profile photo of another user),
description (the description of the notification),
registry (record date),
seen (a Boolean that checks if the person has already viewed)
How do I create notifications? Well, this happens at the time the action is performed. For example, I click the Next button, under the function I register the notification, like this:
user_id : User id I followed,
icon : My profile picture,
description : Insanity started following you !,
registry : CURRENT_TIME (),
seen : 0
I have two main problems:
- If I click the follow button multiple times, it will send multiple notifications.
- The problem of grouping: If more than one person follows, let's suppose 1000 people do this, 1000 notifications will appear. How to group Facebook, for example: "Geraldo, Thiago and over 998 people have started following you!".