class Cloner
{
- protected PageRepo $pageRepo;
- protected ChapterRepo $chapterRepo;
- protected BookRepo $bookRepo;
- protected ImageService $imageService;
-
- public function __construct(PageRepo $pageRepo, ChapterRepo $chapterRepo, BookRepo $bookRepo, ImageService $imageService)
- {
- $this->pageRepo = $pageRepo;
- $this->chapterRepo = $chapterRepo;
- $this->bookRepo = $bookRepo;
- $this->imageService = $imageService;
+ public function __construct(
+ protected PageRepo $pageRepo,
+ protected ChapterRepo $chapterRepo,
+ protected BookRepo $bookRepo,
+ protected ImageService $imageService,
+ ) {
}
/**
$copyBook = $this->bookRepo->create($bookDetails);
// Clone contents
- $directChildren = $original->getDirectChildren();
+ $directChildren = $original->getDirectVisibleChildren();
foreach ($directChildren as $child) {
if ($child instanceof Chapter && userCan('chapter-create', $copyBook)) {
$this->cloneChapter($child, $copyBook, $child->name);