Answer the question
In order to leave comments, you need to log in
How to make the status of unread comments?
Good afternoon.
There is a project in which there are users and there are comments to some entity.
How to properly indicate unread messages? Those. for one user, the message "A" may be read, and for another, the same message "A" may be unread.
Nothing but a table for unread comments pirhod (id_comment, id_user) Yii2
project.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
record the date of the last visit to the topic, and consider all comments that were after the date of the last visit unread.
Attendance statistics are not kept?
You can keep statistics on which pages the user was on at what time.
Accordingly, correlate the time of visit and the time of publication of comments.
Nothing except the table for unread comments feasts
(id_comment, id_user)
comments
id, user_id, text, ...
comment_views
id, comment_id, user_id, ...
And why does everyone always try to write everything to the database? There are cookies, and in most cases it is enough to write the client in cookies and that's it. Why load the base?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question