调整首页
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user