]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Repos/PageRepo.php
No need to save page
[bookstack] / app / Entities / Repos / PageRepo.php
index 5d6fc8fa81a5afbb8c3f5ac7f6fbf902dbff45f2..501b19c78fa84ba712ffeee46c2c61194caa94cf 100644 (file)
@@ -307,15 +307,13 @@ class PageRepo
         }
 
         if ($parent instanceof Chapter) {
-            $parentChapter = $parent;
-            $parent = $parent->book;
-            $page->chapter_id = $parentChapter->id;
-            $page->save();
+            $page->chapter_id = $parent->id;
         }
 
         $page->changeBook($parent instanceof Book ? $parent->id : $parent->book->id);
         $page->rebuildPermissions();
-        return $parent;
+
+        return ($parent instanceof Book ? $parent : $parent->book);
     }
 
     /**