- $page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
- $this->checkOwnablePermission('page-update', $page);
-
- $entitySelection = $request->get('entity_selection', null);
- if ($entitySelection === null || $entitySelection === '') {
- return redirect($page->getUrl());
- }
-
- $stringExploded = explode(':', $entitySelection);
- $entityType = $stringExploded[0];
- $entityId = intval($stringExploded[1]);
-
-
- try {
- $parent = $this->entityRepo->getById($entityType, $entityId);
- } catch (\Exception $e) {
- session()->flash(trans('entities.selected_book_chapter_not_found'));
- return redirect()->back();
- }
+ $page = $this->pageRepo->getBySlug($bookSlug, $pageSlug);
+ $this->checkOwnablePermission('restrictions-manage', $page);