$shelf = $this->bookshelfRepo->getBySlug($slug);
$this->checkOwnablePermission('book-view', $shelf);
+ $sort = setting()->getForCurrentUser('shelf_books_sort', 'name');
+ $order = setting()->getForCurrentUser('shelf_books_sort_order', 'asc');
+
+ $visibleShelfBooks = $shelf->visibleBooks()->get();
+ $sortedVisibleShelfBooks = $visibleShelfBooks
+ ->sortBy($sort, SORT_REGULAR, $order === 'desc')
+ ->values()
+ ->all();
+
Views::add($shelf);
$this->entityContextManager->setShelfContext($shelf->id);
- $view = setting()->getForCurrentUser('bookshelf_view_type', config('app.views.books'));
+ $view = setting()->getForCurrentUser('bookshelf_view_type');
$this->setPageTitle($shelf->getShortName());
return view('shelves.show', [