if ($filterType === 'page') {
$query->where('uploaded_to', '=', $contextPage->id);
} elseif ($filterType === 'book') {
- $validPageIds = $contextPage->book->pages()->visible()->pluck('id')->toArray();
+ $validPageIds = $contextPage->book->pages()
+ ->scopes('visible')
+ ->pluck('id')
+ ->toArray();
$query->whereIn('uploaded_to', $validPageIds);
}
};