Made books and shelf listing views slightly more efficient

This commit is contained in:
Dan Brown 2021-01-10 23:12:51 +00:00
parent d0a7a8b890
commit da7c686541
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
2 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ class BookRepo
*/ */
public function getAllPaginated(int $count = 20, string $sort = 'name', string $order = 'asc'): LengthAwarePaginator 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);
} }
/** /**

View File

@ -30,7 +30,7 @@ class BookshelfRepo
public function getAllPaginated(int $count = 20, string $sort = 'name', string $order = 'asc'): LengthAwarePaginator public function getAllPaginated(int $count = 20, string $sort = 'name', string $order = 'asc'): LengthAwarePaginator
{ {
return Bookshelf::visible() return Bookshelf::visible()
->with('visibleBooks') ->with(['visibleBooks', 'cover'])
->orderBy($sort, $order) ->orderBy($sort, $order)
->paginate($count); ->paginate($count);
} }