Skip to content

Commit 8b9bcc1

Browse files
committed
Search: Fixed last commented filter when using table prefixes
1 parent 51287d5 commit 8b9bcc1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/Search/SearchRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ protected function sortByLastCommented(EloquentBuilder $query, Entity $model, bo
463463
$morphClass = str_replace('\\', '\\\\', $model->getMorphClass());
464464
$commentQuery = DB::raw('(SELECT c1.entity_id, c1.entity_type, c1.created_at as last_commented FROM ' . $commentsTable . ' c1 LEFT JOIN ' . $commentsTable . ' c2 ON (c1.entity_id = c2.entity_id AND c1.entity_type = c2.entity_type AND c1.created_at < c2.created_at) WHERE c1.entity_type = \'' . $morphClass . '\' AND c2.created_at IS NULL) as comments');
465465

466-
$query->join($commentQuery, $model->getTable() . '.id', '=', 'comments.entity_id')
466+
$query->join($commentQuery, $model->getTable() . '.id', '=', DB::raw('comments.entity_id'))
467467
->orderBy('last_commented', $negated ? 'asc' : 'desc');
468468
}
469469
}

0 commit comments

Comments
 (0)