FIX: fix typo in COALESCE and escaping

This commit is contained in:
Michal Kváček
2016-04-06 20:30:55 +02:00
parent 43051501bd
commit 7fc01fa1ec
+1 -1
View File
@@ -177,7 +177,7 @@ class Content extends Model
// join user email and user name to results when needed // join user email and user name to results when needed
if ($joinAuthor) { if ($joinAuthor) {
$query = $query->join('users', 'users.id', '=', 'contents.user_id') $query = $query->join('users', 'users.id', '=', 'contents.user_id')
->addSelect('COALESCE(users.name, users.email) AS author_name') ->addSelect(DB::raw('COALESCE(users.name, users.email) AS author_name'))
->addSelect('users.email AS author_email'); ->addSelect('users.email AS author_email');
} }