BookStack\Repos\PageRepo::changePageParent PHP Method

changePageParent() public method

Change the page's parent to the given entity.
public changePageParent ( Page $page, Entity $parent )
$page BookStack\Page
$parent BookStack\Entity
    public function changePageParent(Page $page, Entity $parent)
    {
        $book = $parent->isA('book') ? $parent : $parent->book;
        $page->chapter_id = $parent->isA('chapter') ? $parent->id : 0;
        $page->save();
        $page = $this->changeBook($book->id, $page);
        $page->load('book');
        $this->permissionService->buildJointPermissionsForEntity($book);
    }