]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Repos/BookRepo.php
ExportFormatter: Add book description and check for empty book and chapter descriptio...
[bookstack] / app / Entities / Repos / BookRepo.php
index 26b9414fbac24ebd74cb7db1d9d604e422029a42..19d159eb1e7e9cc539a86f6031ef8004a20e70ef 100644 (file)
@@ -17,7 +17,8 @@ class BookRepo
     public function __construct(
         protected BaseRepo $baseRepo,
         protected TagRepo $tagRepo,
-        protected ImageRepo $imageRepo
+        protected ImageRepo $imageRepo,
+        protected TrashCan $trashCan,
     ) {
     }
 
@@ -73,10 +74,9 @@ class BookRepo
      */
     public function destroy(Book $book)
     {
-        $trashCan = new TrashCan();
-        $trashCan->softDestroyBook($book);
+        $this->trashCan->softDestroyBook($book);
         Activity::add(ActivityType::BOOK_DELETE, $book);
 
-        $trashCan->autoClearOld();
+        $this->trashCan->autoClearOld();
     }
 }