mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-06 12:02:45 +03:00
Shelf view: Updated books to be database sorted
Fixes issue where sorting would not match other database-sorted parts of app due to case sensitivity differences. Added test to cover. For #4341
This commit is contained in:
@@ -30,7 +30,7 @@ class BookshelfController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the book.
|
||||
* Display a listing of bookshelves.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
@@ -111,8 +111,9 @@ class BookshelfController extends Controller
|
||||
]);
|
||||
|
||||
$sort = $listOptions->getSort();
|
||||
$sortedVisibleShelfBooks = $shelf->visibleBooks()->get()
|
||||
->sortBy($sort === 'default' ? 'pivot.order' : $sort, SORT_REGULAR, $listOptions->getOrder() === 'desc')
|
||||
$sortedVisibleShelfBooks = $shelf->visibleBooks()
|
||||
->reorder($sort === 'default' ? 'order' : $sort, $listOptions->getOrder())
|
||||
->get()
|
||||
->values()
|
||||
->all();
|
||||
|
||||
|
Reference in New Issue
Block a user