From 9936525df37830b38eebaec90111be53463b9449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=84=E5=B0=98?= <122383162@qq.com> Date: Fri, 5 Nov 2021 11:59:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/CategoryController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 472acd0..faeb19d 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -10,7 +10,7 @@ class CategoryController extends Controller /** * 显示分类 - * @param Category $category [description] + * @param Category $category [description] * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View [type] [description] */ public function index(Category $category) @@ -18,7 +18,11 @@ class CategoryController extends Controller if ($category->type == Category::TYPE_SHOW && $category->article_id) { return redirect("articles/" . $category->article_id); } else { - $articles = $category->relations(Category::TYPE_ARTICLE)->where('status', 1)->latest()->paginate(); + $articles = $category->relations(Category::TYPE_ARTICLE) + ->where('status', 1) + ->latest('sort') + ->latest() + ->paginate(); $parent = $category; if ($category->childrens->isEmpty() && $category->parent) {