Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Conversation Bug? #49

Closed
malebolgia opened this issue Apr 28, 2016 · 3 comments
Closed

Creating Conversation Bug? #49

malebolgia opened this issue Apr 28, 2016 · 3 comments

Comments

@malebolgia
Copy link

malebolgia commented Apr 28, 2016

$conv_id = \TBMsg::createConversation($users_ids=array(Auth::user()->id, $data['owner']->id  ));
$conv = \TBMsg::addMessageToConversation($conv_id, Auth::user()->id, $body_message);

Let me know if I am doing it right? I am starting a conversation then will add message, but when inserting to message, somehow I am getting this error:
UserNotInConvException in EloquentTBMsgRepository.php line 67:

Please let me know if the above code is the right way to start a conversation?

@Raou1d
Copy link
Contributor

Raou1d commented Apr 28, 2016

Does $data really contain an object? Try printen out $data to make sure it contains an user object that you can call ->ID on

@malebolgia
Copy link
Author

Hi Raoul, thanks for quick response, $data got value as I look at database, conv_users table got 2 user ids, actually when I replaced addMessageToConversation $conv_id with conversation id that was added before:

$conv = \TBMsg::addMessageToConversation(1, Auth::user()->id, $body_message);

it is working, I am not sure if it doesn't see the newly added $conv_id that the function createConversation just created.

@malebolgia
Copy link
Author

My Bad, I should be getting convId in array :|

$conv_id = \TBMsg::createConversation($users_ids=array(Auth::user()->id, $data['owner']->id  ));
$conv = \TBMsg::addMessageToConversation($conv_id['convId'], Auth::user()->id, $body_message);

Above worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants