Skip to content

Commit a7cc3c5

Browse files
pascalbaljetcmgmyr
authored andcommitted
Bugfix in Thread Model
1 parent 73fd721 commit a7cc3c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Cmgmyr/Messenger/Models/Thread.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function scopeForUser($query, $userId)
125125
{
126126
$participantTable = $this->getParticipantTable();
127127

128-
return $query->join($participantTable, 'threads.id', '=', $participantTable . '.thread_id')
128+
return $query->join($participantTable, $this->getQualifiedKeyName(), '=', $participantTable . '.thread_id')
129129
->where($participantTable . '.user_id', $userId)
130130
->where($participantTable . '.deleted_at', null)
131131
->select($this->getTable() . '.*');
@@ -142,7 +142,7 @@ public function scopeForUserWithNewMessages($query, $userId)
142142
{
143143
$participantTable = $this->getParticipantTable();
144144

145-
return $query->join($participantTable, 'threads.id', '=', $participantTable . '.thread_id')
145+
return $query->join($participantTable, $this->getQualifiedKeyName(), '=', $participantTable . '.thread_id')
146146
->where($participantTable . '.user_id', $userId)
147147
->whereNull($participantTable . '.deleted_at')
148148
->where(function ($query) use ($participantTable) {

0 commit comments

Comments
 (0)