]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Controllers/BookshelfController.php
Fixed OIDC Logout
[bookstack] / app / Entities / Controllers / BookshelfController.php
index 271b13a55d15103cc51e09eabe72782b1d8671ce..fcfd37538724a8c653e9997e3df732011cd30243 100644 (file)
@@ -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();