]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Repos/ChapterRepo.php
Fixed OIDC Logout
[bookstack] / app / Entities / Repos / ChapterRepo.php
index dadeec7f897d41132f94741923301b16ca047810..977193d85bbd0229a2d1a1e745dbf5fd01dd4a83 100644 (file)
@@ -16,14 +16,9 @@ use Exception;
 
 class ChapterRepo
 {
-    protected $baseRepo;
-
-    /**
-     * ChapterRepo constructor.
-     */
-    public function __construct(BaseRepo $baseRepo)
-    {
-        $this->baseRepo = $baseRepo;
+    public function __construct(
+        protected BaseRepo $baseRepo
+    ) {
     }
 
     /**
@@ -49,7 +44,7 @@ class ChapterRepo
     {
         $chapter = new Chapter();
         $chapter->book_id = $parentBook->id;
-        $chapter->priority = $chapter->priority ?: (new BookContents($parentBook))->getLastPriority() + 1;
+        $chapter->priority = (new BookContents($parentBook))->getLastPriority() + 1;
         $this->baseRepo->create($chapter, $input);
         Activity::add(ActivityType::CHAPTER_CREATE, $chapter);