]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Repos/ChapterRepo.php
add priority on page and chapter create
[bookstack] / app / Entities / Repos / ChapterRepo.php
index 588854c7e91c34b05280a3458ed13ff72d5f7fa1..dadeec7f897d41132f94741923301b16ca047810 100644 (file)
@@ -49,7 +49,7 @@ class ChapterRepo
     {
         $chapter = new Chapter();
         $chapter->book_id = $parentBook->id;
-        $chapter->priority = (new BookContents($parentBook))->getLastPriority() + 1;
+        $chapter->priority = $chapter->priority ?: (new BookContents($parentBook))->getLastPriority() + 1;
         $this->baseRepo->create($chapter, $input);
         Activity::add(ActivityType::CHAPTER_CREATE, $chapter);