+ if ($request->has('book_id') && $chapter->book_id !== intval($requestData['book_id'])) {
+ $this->checkOwnablePermission('chapter-delete', $chapter);
+
+ try {
+ $this->chapterRepo->move($chapter, "book:{$requestData['book_id']}");
+ } catch (Exception $exception) {
+ if ($exception instanceof PermissionsException) {
+ $this->showPermissionError();
+ }
+
+ return $this->jsonError(trans('errors.selected_book_not_found'));
+ }
+ }
+
+ $updatedChapter = $this->chapterRepo->update($chapter, $requestData);