Skip to content

NOW MANAGED ON CODEBERG

Made books and shelf listing views slightly more efficient

Dan Brownda7c686541ee
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);
}