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