+ $this->showSuccessNotification(trans('entities.chapter_move_success', ['bookName' => $newBook->name]));
+
+ return redirect($chapter->getUrl());
+ }
+
+ /**
+ * Show the view to copy a chapter.
+ *
+ * @throws NotFoundException
+ */
+ public function showCopy(string $bookSlug, string $chapterSlug)
+ {
+ $chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
+ $this->checkOwnablePermission('chapter-view', $chapter);
+
+ session()->flashInput(['name' => $chapter->name]);
+
+ return view('chapters.copy', [
+ 'book' => $chapter->book,
+ 'chapter' => $chapter,
+ ]);
+ }
+
+ /**
+ * Create a copy of a chapter within the requested target destination.
+ *
+ * @throws NotFoundException
+ * @throws Throwable
+ */
+ public function copy(Request $request, Cloner $cloner, string $bookSlug, string $chapterSlug)
+ {
+ $chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
+ $this->checkOwnablePermission('chapter-view', $chapter);
+
+ $entitySelection = $request->get('entity_selection') ?: null;
+ $newParentBook = $entitySelection ? $this->chapterRepo->findParentByIdentifier($entitySelection) : $chapter->getParent();
+
+ if (is_null($newParentBook)) {
+ $this->showErrorNotification(trans('errors.selected_book_not_found'));
+