]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Tools/TrashCan.php
Guest create page: name field autofocus
[bookstack] / app / Entities / Tools / TrashCan.php
index 015610e717b0571649ced0331b9acc7821a8a076..7341a032816ac5a10b08b39277d1cf6cc3b2c0e7 100644 (file)
@@ -22,6 +22,7 @@ class TrashCan
 {
     /**
      * Send a shelf to the recycle bin.
+     *
      * @throws NotifyException
      */
     public function softDestroyShelf(Bookshelf $shelf)
@@ -343,7 +344,7 @@ class TrashCan
      *
      * @throws Exception
      */
-    protected function destroyEntity(Entity $entity): int
+    public function destroyEntity(Entity $entity): int
     {
         if ($entity instanceof Page) {
             return $this->destroyPage($entity);
@@ -375,6 +376,8 @@ class TrashCan
         $entity->searchTerms()->delete();
         $entity->deletions()->delete();
         $entity->favourites()->delete();
+        $entity->referencesTo()->delete();
+        $entity->referencesFrom()->delete();
 
         if ($entity instanceof HasCoverImage && $entity->cover()->exists()) {
             $imageService = app()->make(ImageService::class);