Skip to content

Commit

Permalink
Method whereHas should accept relation but not a table name.
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkomarev authored and cmgmyr committed Jan 29, 2016
1 parent c180e70 commit 0f69f25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Cmgmyr/Messenger/Models/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function scopeForUserWithNewMessages($query, $userId)
*/
public function scopeBetween($query, array $participants)
{
$query->whereHas($this->getParticipantTable(), function ($query) use ($participants) {
$query->whereHas('participants', function ($query) use ($participants) {
$query->whereIn('user_id', $participants)
->groupBy('thread_id')
->havingRaw('COUNT(thread_id)=' . count($participants));
Expand Down

0 comments on commit 0f69f25

Please sign in to comment.