Fix sorting textures in skin library
This commit is contained in:
parent
2eab303457
commit
85eefad0b1
@ -96,21 +96,12 @@ class SkinlibController extends Controller
|
|||||||
|
|
||||||
$totalPages = ceil($query->count() / $itemsPerPage);
|
$totalPages = ceil($query->count() / $itemsPerPage);
|
||||||
|
|
||||||
// Available sorting methods: time
|
|
||||||
$sort = $request->input('sort', 'time');
|
$sort = $request->input('sort', 'time');
|
||||||
$sortBy = ($sort == 'time') ? 'upload_at' : $sort;
|
$sortBy = ($sort == 'time') ? 'upload_at' : $sort;
|
||||||
// `likes` property is not actually existed in database.
|
$query->withCount('likers as likes');
|
||||||
if ($sortBy != 'likes') {
|
|
||||||
$query = $query->orderBy($sortBy, 'desc');
|
$query = $query->orderBy($sortBy, 'desc');
|
||||||
}
|
|
||||||
|
|
||||||
$textures = $query->skip(($currentPage - 1) * $itemsPerPage)
|
$textures = $query->skip(($currentPage - 1) * $itemsPerPage)->take($itemsPerPage)->get();
|
||||||
->take($itemsPerPage)
|
|
||||||
->get();
|
|
||||||
|
|
||||||
if ($sortBy == 'likes') {
|
|
||||||
$textures = $textures->sortByDesc('likes')->values();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$closet = $user->closet()->get();
|
$closet = $user->closet()->get();
|
||||||
|
@ -2,3 +2,4 @@
|
|||||||
|
|
||||||
- Fixed dropdown menu of skin library for mobile users.
|
- Fixed dropdown menu of skin library for mobile users.
|
||||||
- Fixed previewing alex textures.
|
- Fixed previewing alex textures.
|
||||||
|
- Fixed sorting textures in skin library.
|
||||||
|
@ -2,3 +2,4 @@
|
|||||||
|
|
||||||
- 修复移动端下皮肤库下拉菜单失效的问题
|
- 修复移动端下皮肤库下拉菜单失效的问题
|
||||||
- 修复 Alex 材质的预览
|
- 修复 Alex 材质的预览
|
||||||
|
- 修复皮肤库中的排序问题
|
||||||
|
Loading…
Reference in New Issue
Block a user