I have a user model and friendship model. Now I want make that when one user have accepted a new friend, the others friends of this user could see this last activity of her friend. How is the best form to do it?
Thanks.
I have a user model and friendship model. Now I want make that when one user have accepted a new friend, the others friends of this user could see this last activity of her friend. How is the best form to do it?
Thanks.
The first part has been covered recently - have you checked this forum??
If you freindship model/table is something as follows:
friend_id (int,primary key)
target (int, foreign key on user_id)
requester (int, foreign_key on user_id)
status (tinyint or char stating pending/acccepted/refused)
date_accept (date when accepted)
You have a variety of sql methods, including:
1) nested select statements
2) grouping with inner joins
These can be filtered so that only those within the last week say (calculated from date_accept) are displayed under a new friends section.
Hi, thanks for the reply, I have searched in the forum but I don't get the solution. I have the same model/table, one ask more: If I have a lot of people in the web, and therfore a lot of rows of friends, can do that this process will be very slow? I in the forum of database I did the same question and I get this reply:
Ramy Mahrous:
You merge logic or business of your application and the design of the database, you don't need to modify the design if you correctly did it, rather in application check the new friends list in a friend and show them in say news feed to their friends like Facebook.
After he told me that the best was that I will ask in this forum, and now I do it. Can any tell me how I can do the solution that he tell for do the same that Facebook or what is the best solution?
Thanks.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.