manhlinhit
6/26/2017 - 10:40 AM

chat.lar

$messages_me_to = Message::where('user_id', $user->id)
                        ->where('user_rec_id', $user_chat['id'])
                        ->get();
$messages_to_me = Message::where('user_id', $user_chat['id'])
                    ->where('user_rec_id', $user->id)
                    ->get();
$messages = $messages_me_to->merge($messages_to_me);
$messages = $messages->sortBy('id');
return $messages->toJson();