调整首页

This commit is contained in:
2021-03-30 09:44:14 +08:00
parent e19ccdde87
commit e7a7b9b690
3 changed files with 24 additions and 6 deletions

View File

@@ -153,3 +153,20 @@ function getAdvertsByCate($categoryId, $take = 8)
->get();
}
function getArticlesByCateIds($take = 8, $hasCover = false)
{
$ids = [7, 17, 8, 5, 12, 30];
$articles = Article::whereIn('category_id', $ids)
->where('status', 1)
->latest()
->when($hasCover, function ($q) {
$q->whereNotNull('cover');
})
->take($take)
->get();
return $articles;
}