- $chapter->load([
- 'createdBy', 'updatedBy', 'ownedBy',
- 'pages' => function (HasMany $query) {
- $query->scopes('visible')->get(['id', 'name', 'slug']);
- }
- ]);
+ $chapter->load(['createdBy', 'updatedBy', 'ownedBy']);
+
+ // Note: More fields than usual here, for backwards compatibility,
+ // due to previously accidentally including more fields that desired.
+ $pages = $this->entityQueries->pages->visibleForChapterList($chapter->id)
+ ->addSelect(['created_by', 'updated_by', 'revision_count', 'editor'])
+ ->get();
+ $chapter->setRelation('pages', $pages);