->scopes('visible')
->select(array_merge(static::$listAttributes, ['book_slug' => function ($builder) {
$builder->select('slug')
- ->from('books')
- ->whereColumn('books.id', '=', 'chapters.book_id');
+ ->from('entities as books')
+ ->where('type', '=', 'book')
+ ->whereColumn('books.id', '=', 'entities.book_id');
}]));
}
+
+ public function visibleForContent(): Builder
+ {
+ return $this->start()->scopes('visible');
+ }
}