I am trying to apply a buddy list to a user so that the user can have many friends
But to call friends I'm having trouble correcting my relationship:
User ID friends user_id friend_user_id
class user :
Public Function Friends () {Return $ this- & gt; There are many ('app \ user', 'friend'); }
then author :: user () - & gt; Friend
to user
model
< P> In fact, you do not have "many" relationships, rather than "many people" with friends being your participation table
Try it out:
Public Function Friends () {Return $ this- & gt; For affiliation ('AP user', 'friend' 'User_id', 'friend_user_id'); }
Comments
Post a Comment