]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Repos/ChapterRepo.php
TS: Converted dom and keyboard nav services
[bookstack] / app / Entities / Repos / ChapterRepo.php
index cacca93f6e9f2968ee22fe57969b3bff61e5003a..17cbccd4133676bc44aac8aaf844478ba771e5c7 100644 (file)
@@ -18,6 +18,7 @@ class ChapterRepo
     public function __construct(
         protected BaseRepo $baseRepo,
         protected EntityQueries $entityQueries,
+        protected TrashCan $trashCan,
     ) {
     }
 
@@ -59,10 +60,9 @@ class ChapterRepo
      */
     public function destroy(Chapter $chapter)
     {
-        $trashCan = new TrashCan();
-        $trashCan->softDestroyChapter($chapter);
+        $this->trashCan->softDestroyChapter($chapter);
         Activity::add(ActivityType::CHAPTER_DELETE, $chapter);
-        $trashCan->autoClearOld();
+        $this->trashCan->autoClearOld();
     }
 
     /**