musonza / chat

A Laravel chat package. You can use this package to create a chat/messaging Laravel application.
MIT License
1.13k stars 311 forks source link

Need for 'data' column in message table #289

Closed ali4zimi closed 2 years ago

ali4zimi commented 3 years ago

A column ('data') to store details about each message was added. For instance, if our message type is an image, we can add the image link, or if it is a link we can store the link and attachment details in it. The conversation table already has this column, I think there is a need for this in the message table too.

dhi2 commented 2 years ago

@azimi-ali @musonza This is only the migration, can we also include the methods to add the JSON data upon sending the message like here: https://github.com/musonza/chat/#send-a-message-of-custom-type so it becomes something like:

$message = Chat::message('http://example.com/img')
        ->data([
            'new_data' => 'my new JSON data'
        ])
        ->type('image')
        ->from($model)
        ->to($conversation)
        ->send();
ali4zimi commented 2 years ago

At first, I apologize that I mistakenly closed the branch.

But then, I appreciate your comment because it is a good idea to have a function to add more details to the data. So feel free to add your code or if you want me to add it comment back.

dhi2 commented 2 years ago

@azimi-ali Yes please if you can add it would be much appreciated.

musonza commented 2 years ago

@azimi-ali thanks for the additions. Do you mind adding a unit test for the changes?

ali4zimi commented 2 years ago

@musonza If you don't mind, please wait a few hours. Some changes are missing. I will push it today.

musonza commented 2 years ago

@azimi-ali no worries. Take your time and let me know whenever ready

ali4zimi commented 2 years ago

Dear @musonza, and @dhi2, Accept my apologies. The old project has been deleted accidentally, and I couldn't push my changes to the old PR anymore. Therefore, I have opened a new pull request, and I want to close this PR.