更新
This commit is contained in:
@@ -53,7 +53,8 @@ function getOneArticleBYCate($categoryId, $result = '')
|
||||
->whereHas('categories', function ($q) use ($categoryId) {
|
||||
$q->where('id', $categoryId);
|
||||
})
|
||||
->latest()
|
||||
->latest('sort')
|
||||
->latest('created_at')
|
||||
->first();
|
||||
|
||||
if ($info) {
|
||||
@@ -87,7 +88,8 @@ function getArticlesBYCate($categoryId, $take = 8, $mark = 'one', $hasCover = fa
|
||||
->whereHas('categories', function ($q) use ($categoryId) {
|
||||
$q->where('id', $categoryId);
|
||||
})
|
||||
->orderBy('sort', $order)
|
||||
->latest('sort')
|
||||
->latest('created_at')
|
||||
->when($hasCover, function ($q) {
|
||||
$q->whereNotNull('cover');
|
||||
})
|
||||
@@ -104,7 +106,8 @@ function getArticlesBYCate($categoryId, $take = 8, $mark = 'one', $hasCover = fa
|
||||
->when($hasCover, function ($q) {
|
||||
$q->whereNotNull('cover');
|
||||
})
|
||||
->orderBy('sort', $order)
|
||||
->latest('sort')
|
||||
->latest('created_at')
|
||||
->take($take)
|
||||
->get();
|
||||
}
|
||||
@@ -179,7 +182,8 @@ function getArticlesByCateIds($take = 8, $hasCover = false)
|
||||
->whereHas('categories', function ($q) use ($ids) {
|
||||
$q->whereIn('id', $ids);
|
||||
})
|
||||
->latest()
|
||||
->latest('sort')
|
||||
->latest('created_at')
|
||||
->when($hasCover, function ($q) {
|
||||
$q->whereNotNull('cover')->orWhere('cover', '<>', '');
|
||||
})
|
||||
@@ -200,7 +204,8 @@ function getArticlesByCateIds($take = 8, $hasCover = false)
|
||||
function getArticlesByPosition($postion)
|
||||
{
|
||||
$articles = Article::ofPosition($postion)
|
||||
->latest()
|
||||
->latest('sort')
|
||||
->latest('created_at')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user