]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Repos/PageRepo.php
Add footer element, styles, and associated settings
[bookstack] / app / Entities / Repos / PageRepo.php
index 501b19c78fa84ba712ffeee46c2c61194caa94cf..e49eeb1ef5518eb8aa124d11e981236f11ebbe04 100644 (file)
@@ -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();