Skip to content

Commit 6ba4d2a

Browse files
committed
Update category retrieval logic in CategoryController to order categories by creation date descending. This change improves the organization of category data returned in the API response.
1 parent bc04f7a commit 6ba4d2a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/Http/Controllers/Admin/CategoryController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function index()
2020
}
2121

2222
public function all(){
23-
$categories = CategoryResource::collection(Category::all());
23+
$categories = CategoryResource::collection(Category::orderBy('created_at', 'desc')->get());
2424
return response()->json(['categories'=>$categories],200);
2525
}
2626

0 commit comments

Comments
 (0)