$messages = collect(Message::where('recipient_id', $user)->get()); $messagesUnique = $messages->unique('recipient_id'); $messagesUnique->values()->all();