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();