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)
222222 */
223223 public function scopeBetweenOnly (Builder $ query , array $ participants )
224224 {
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 ) {
226228 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 )]);
230232 });
231233 }
232234
You can’t perform that action at this time.
0 commit comments