+
+ Activity::add($chapter, 'chapter_move', $newBook->id);
+
+ $this->showSuccessNotification(trans('entities.chapter_move_success', ['bookName' => $newBook->name]));
+ return redirect($chapter->getUrl());
+ }
+
+ /**
+ * Show the Restrictions view.
+ * @throws NotFoundException
+ */
+ public function showPermissions(string $bookSlug, string $chapterSlug)
+ {
+ $chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
+ $this->checkOwnablePermission('restrictions-manage', $chapter);
+
+ return view('chapters.permissions', [
+ 'chapter' => $chapter,
+ ]);
+ }
+
+ /**
+ * Set the restrictions for this chapter.
+ * @throws NotFoundException
+ */
+ public function permissions(Request $request, string $bookSlug, string $chapterSlug)
+ {
+ $chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
+ $this->checkOwnablePermission('restrictions-manage', $chapter);
+
+ $restricted = $request->get('restricted') === 'true';
+ $permissions = $request->filled('restrictions') ? collect($request->get('restrictions')) : null;
+ $this->chapterRepo->updatePermissions($chapter, $restricted, $permissions);
+
+ $this->showSuccessNotification(trans('entities.chapters_permissions_success'));
+ return redirect($chapter->getUrl());