Skip to content

Commit

Permalink
Merge pull request #194 from cmgmyr/bug/#193-db-prefix-query-exception,
Browse files Browse the repository at this point in the history
closes #193

add db prefix to raw query
  • Loading branch information
cmgmyr authored Jan 7, 2017
2 parents 9eb9f3b + 7d7d1f7 commit acf68ed
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 acf68ed

Please sign in to comment.