]> BookStack Code Mirror - bookstack/commitdiff
Made books and shelf listing views slightly more efficient
authorDan Brown <redacted>
Sun, 10 Jan 2021 23:12:51 +0000 (23:12 +0000)
committerDan Brown <redacted>
Sun, 10 Jan 2021 23:12:51 +0000 (23:12 +0000)
app/Entities/Repos/BookRepo.php
app/Entities/Repos/BookshelfRepo.php

index 68d62887b72293b1717468cae9b5e6430acc505d..27d0b407541d02857d8aec46cadbeb71cf7bc840 100644 (file)
@@ -35,7 +35,7 @@ class BookRepo
      */
     public function getAllPaginated(int $count = 20, string $sort = 'name', string $order = 'asc'): LengthAwarePaginator
     {
-        return Book::visible()->orderBy($sort, $order)->paginate($count);
+        return Book::visible()->with('cover')->orderBy($sort, $order)->paginate($count);
     }
 
     /**
index b15241fb388735f666ebe3f86ddc2a1f6eaa6911..649f4b0c461c0b461701bd26508af44fe0ab43c2 100644 (file)
@@ -30,7 +30,7 @@ class BookshelfRepo
     public function getAllPaginated(int $count = 20, string $sort = 'name', string $order = 'asc'): LengthAwarePaginator
     {
         return Bookshelf::visible()
-            ->with('visibleBooks')
+            ->with(['visibleBooks', 'cover'])
             ->orderBy($sort, $order)
             ->paginate($count);
     }