This could help you : https://laracasts.com/discuss/channels/tips/package-laravel-5-real-time-chat
Live Chat App / Feature Database Design
Hey,
I have to add Customer Support feature in our project and one of the features of it is live chat. I am still researching around the whole idea.
The whole idea is that I want to allow users to join a room and chat. The chat would be 1-1 between the customer and the support representative but I want to allow for admins or developers or even other support representatives to join the room when needed (not always but let's say for emergency cases only).
So I started thinking about how I would save the chat messages in the database and it seems like a complicated stuff.
This is what I've come up with so far:
user Table
id int primary
username varchar
// other fields
room Table
id int primary
room varchar
timestamps
softdeletes
instant_message Table
id int primary
message text
timestamps
softdeletes
chat Table
id int primary
user_id int foreign references id on user
instant message_id id foreign references id on instant_message
room_id id foreign references id on room
timestamps
softdeletes
I am not sure if this is a good design for a chat. The relationships between the models are:
One Chat - Many Rooms One Chat - Many Users One Chat - Many Instant Messages
but there is probably something wrong with this design and I don't know what it is!
I am trying to design the database to be flexible so I can get more info out of it if needed.
Does anyone know how I can improve this? Anyone ever had any experiences with building a chat app / customer support?
Thanks!
Please or to participate in this conversation.