]> BookStack Code Mirror - bookstack/commitdiff
No need to save page 1752/head
authorjakob <redacted>
Mon, 28 Oct 2019 15:53:48 +0000 (16:53 +0100)
committerjakob <redacted>
Mon, 28 Oct 2019 15:53:48 +0000 (16:53 +0100)
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);
     }
 
     /**