I am having One-to-One chat simple table, where message store as from user id and to user id. here is schema.
I am retrieving conversation between two user by matching either from_user_id match with login user or to_user_id as
->where(function($q) use($user_id) {
$q->where('from_user_id', $user_id)
->orWhere('to_user_id', $user_id);
})
Now i want a unique conversation between login user and other users. i have tried as
->groupBy('from_user_id', 'to_user_id')
but it return both record id : 1 and 6 because it stored as 65 - 66 and 66 - 65.
So any way that i can group by with unique conversasion and get only one record for the same. or i need to change schema of table as conversation and conversation_message.
Please guide me. Thanks.

