Answer the question
In order to leave comments, you need to log in
How to make a request to select conversations from a simple message table between two users?
Not very strong in sql, but I would like to display dialogs on a separate page.
here is the actual structure of the table with messages
data for one dialog I choose like this
$messages = DB::table('messages')
->where([
['from_id', '=', $user_id],
['to_id', '=', $companion_id],
])
->orWhere([
['to_id', '=', $user_id],
['from_id', '=', $companion_id],
])
->get();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question