Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
There is a database, I hope?
A like is a classic many-to-many relationship between posts and users.
Those. in addition to the table of posts and the table of users, you make a connected table of two fields - post id and user id. If there is a post in it, the user liked the post. Then you can
a) check in advance if there is such a record, and show "you have already liked"
b) ignore repeated likes if they do come. Just make a couple of user-posts as a key
c) as a bonus - you can count the number of likes for a post and choose what a particular user liked.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question