Only show published items in the popular list
This commit is contained in:
parent
e69b7df500
commit
d9b3012153
@ -59,13 +59,14 @@ class BlogArticleController extends Controller
|
||||
*/
|
||||
public function popular()
|
||||
{
|
||||
$query = BlogArticle::orderBy('views', 'desc')->orderBY('date', 'desc');
|
||||
$data = BlogArticle::select()
|
||||
->orderBy('views', 'desc')
|
||||
->orderBy('date', 'desc')
|
||||
->where('published', true)
|
||||
->limit(5)
|
||||
->get()
|
||||
;
|
||||
|
||||
if (!$this->authService->isAuthenticated()) {
|
||||
$query = $query->where('published', true);
|
||||
}
|
||||
|
||||
$data = $query->limit(5)->get();
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user