nahid / talk

Talk is a real-time users messaging and chatting system for Laravel.
MIT License
1.61k stars 327 forks source link

Custom user id column issue #53

Open jampack opened 7 years ago

jampack commented 7 years ago

In my User table the user id column is 'user_id' apart from default 'id' which is causing issue with Talk::threads() method as it is showing withUser->user_id and rest of the fields same to both the parties which is user one or the one who initiates the conversation. the issue is fixed by changing the id field to user_id in

Nahid\Talk\Conversations\ConversationRepository

threads() method

$conversationWith = ($thread->userone->id == $user) ? $thread->usertwo : $thread->userone;

to

$conversationWith = ($thread->userone->user_id == $user) ? $thread->usertwo : $thread->userone;

May be you should define a variable for that in the talk.config for people having custom field names.

jampack commented 7 years ago

this applies to other methods too, like the same issue with getMessagesByUserID(), where withUser was returned with same user details who initiated the conversation.