X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/e108808a32b865668076b7b032ee620229d44d1f..refs/pull/1973/head:/app/Entities/Repos/PageRepo.php diff --git a/app/Entities/Repos/PageRepo.php b/app/Entities/Repos/PageRepo.php index 501b19c78..e49eeb1ef 100644 --- a/app/Entities/Repos/PageRepo.php +++ b/app/Entities/Repos/PageRepo.php @@ -306,10 +306,7 @@ class PageRepo throw new PermissionsException('User does not have permission to create a page within the new parent'); } - if ($parent instanceof Chapter) { - $page->chapter_id = $parent->id; - } - + $page->chapter_id = ($parent instanceof Chapter) ? $parent->id : null; $page->changeBook($parent instanceof Book ? $parent->id : $parent->book->id); $page->rebuildPermissions();