Skip to content

Commit

Permalink
add db prefix to raw query
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgmyr committed Jan 7, 2017
1 parent 16d99c7 commit 097a57e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Cmgmyr/Messenger/Traits/Messagable.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function threadsWithNewMessages()
return $this->threads()
->where(function ($q) {
$q->whereNull(Models::table('participants') . '.last_read');
$q->orWhere(Models::table('threads') . '.updated_at', '>', $this->getConnection()->raw(Models::table('participants') . '.last_read'));
$q->orWhere(Models::table('threads') . '.updated_at', '>', $this->getConnection()->raw($this->getConnection()->getTablePrefix() . Models::table('participants') . '.last_read'));
})->get();
}
}
2 changes: 1 addition & 1 deletion src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'thread_model' => Cmgmyr\Messenger\Models\Thread::class,

/**
* Define custom database table names.
* Define custom database table names - without prefixes.
*/
'messages_table' => null,

Expand Down

0 comments on commit 097a57e

Please sign in to comment.