|
@@ -65,9 +65,12 @@ class NewsService implements NewsServiceInterface
|
|
private function findMatchedCategories($search)
|
|
private function findMatchedCategories($search)
|
|
{
|
|
{
|
|
if ($search) {
|
|
if ($search) {
|
|
- return Category::where('name', 'like', "%{$search}%")->get();
|
|
|
|
|
|
+ return Category::where('name', 'like', "%{$search}%")
|
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
|
+ ->get();
|
|
}
|
|
}
|
|
- return Category::all();
|
|
|
|
|
|
+ return Category::orderBy('updated_at', 'desc') // 按 updated_at 字段倒序排序
|
|
|
|
+ ->get();
|
|
}
|
|
}
|
|
|
|
|
|
private function findAllParents($categories)
|
|
private function findAllParents($categories)
|