X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/295cd0160525125bbd7756d7ad07392ae7201cb8..refs/pull/4467/head:/app/Entities/Controllers/BookshelfController.php diff --git a/app/Entities/Controllers/BookshelfController.php b/app/Entities/Controllers/BookshelfController.php index 271b13a55..fcfd37538 100644 --- a/app/Entities/Controllers/BookshelfController.php +++ b/app/Entities/Controllers/BookshelfController.php @@ -9,7 +9,7 @@ use BookStack\Entities\Repos\BookshelfRepo; use BookStack\Entities\Tools\ShelfContext; use BookStack\Exceptions\ImageUploadException; use BookStack\Exceptions\NotFoundException; -use BookStack\Http\Controllers\Controller; +use BookStack\Http\Controller; use BookStack\References\ReferenceFetcher; use BookStack\Util\SimpleListOptions; use Exception; @@ -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();