File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -222,11 +222,13 @@ public function scopeForUserWithNewMessages(Builder $query, $userId)
222
222
*/
223
223
public function scopeBetweenOnly (Builder $ query , array $ participants )
224
224
{
225
- return $ query ->whereHas ('participants ' , function (Builder $ builder ) use ($ participants ) {
225
+ $ participantTable = Models::table ('participants ' );
226
+
227
+ return $ query ->whereHas ('participants ' , function (Builder $ builder ) use ($ participants , $ participantTable ) {
226
228
return $ builder ->whereIn ('user_id ' , $ participants )
227
- ->groupBy (' participants .thread_id ' )
228
- ->select (' participants .thread_id ' )
229
- ->havingRaw ('COUNT(participants .thread_id)=? ' , [count ($ participants )]);
229
+ ->groupBy ($ participantTable . ' .thread_id ' )
230
+ ->select ($ participantTable . ' .thread_id ' )
231
+ ->havingRaw ('COUNT( ' . $ participantTable . ' .thread_id)=? ' , [count ($ participants )]);
230
232
});
231
233
}
232
234
You can’t perform that action at this time.
0 commit comments