0

I am new to cakephp.

I am working on my Social network project.I am having users and friends relationship

concept.

I am having problem in sending friend request and accepting .....

I am not understanding how to start on this concept...

If anybody worked on such things then please help me..

vk1985
  • 1

1 Answers1

2

You could make a new FriendRequest model.

  1. Give this model belongTo User and hasOne Friend. Also, User hasMany FriendRequest Then, give the FriendRequest model a boolean field (cakePHP uses TINYINT(1) for boolean) to track acceptance.
  2. Create a new FriendRequest record when a user sends a request.
  3. List all FriendRequest records that a user has sent by searching for the ones the user hasMany
  4. List all the FriendRequest records that are sent to a person by searching for all Friend belongTo User.
  5. Change the acceptance field to TRUE when a User accepts the request.
Stephen
  • 18,827
  • 9
  • 60
  • 98