From: Dan Brown Date: Sun, 10 Jan 2021 23:12:51 +0000 (+0000) Subject: Made books and shelf listing views slightly more efficient X-Git-Tag: v0.31.3~1^2~1 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/da7c686541eee0f20b9c85fc2a5e12f6aa6e0ec1 Made books and shelf listing views slightly more efficient --- diff --git a/app/Entities/Repos/BookRepo.php b/app/Entities/Repos/BookRepo.php index 68d62887b..27d0b4075 100644 --- a/app/Entities/Repos/BookRepo.php +++ b/app/Entities/Repos/BookRepo.php @@ -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); } /** diff --git a/app/Entities/Repos/BookshelfRepo.php b/app/Entities/Repos/BookshelfRepo.php index b15241fb3..649f4b0c4 100644 --- a/app/Entities/Repos/BookshelfRepo.php +++ b/app/Entities/Repos/BookshelfRepo.php @@ -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); }