We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6a10052 commit 16d99c7Copy full SHA for 16d99c7
src/Cmgmyr/Messenger/Models/Thread.php
@@ -174,8 +174,9 @@ public function scopeForUserWithNewMessages($query, $userId)
174
*/
175
public function scopeBetween($query, array $participants)
176
{
177
- $query->whereHas('participants', function ($query) use ($participants) {
178
- $query->whereIn('user_id', $participants)
+ return $query->whereHas('participants', function ($q) use ($participants) {
+ $q->whereIn('user_id', $participants)
179
+ ->select($this->getConnection()->raw('DISTINCT(thread_id)'))
180
->groupBy('thread_id')
181
->havingRaw('COUNT(thread_id)=' . count($participants));
182
});
0 commit comments