mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-30 20:51:57 +08:00
Optimized loading of page/chapter URLs to be a little more efficient
- Loaded book_slug as part of chapter/page queries instead of books being loaded in afterwards. - Removed unused page method. - Updated some page queries to load specific attributes.
This commit is contained in:
@ -93,9 +93,11 @@ class BookContents
|
||||
/**
|
||||
* Get the visible pages within this book.
|
||||
*/
|
||||
protected function getPages(bool $showDrafts = false): Collection
|
||||
protected function getPages(bool $showDrafts = false, bool $getPageContent = false): Collection
|
||||
{
|
||||
$query = Page::visible()->where('book_id', '=', $this->book->id);
|
||||
$query = Page::visible()
|
||||
->select($getPageContent ? Page::$contentAttributes : Page::$listAttributes)
|
||||
->where('book_id', '=', $this->book->id);
|
||||
|
||||
if (!$showDrafts) {
|
||||
$query->where('draft', '=', false);
|
||||
|
Reference in New Issue
Block a user