]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Repos/EntityRepo.php
Show bookshelves that a book belongs to on a book view
[bookstack] / app / Entities / Repos / EntityRepo.php
index 13a335ea01d4c6beb75ac1f12a779a898972e363..0dd0fbb0af650f0e3c050171a48673a030a55ee3 100644 (file)
@@ -413,6 +413,17 @@ class EntityRepo
         return collect($tree);
     }
 
+
+    /**
+     * Get the bookshelves that a book is contained in.
+     * @param Book $book
+     * @return \Illuminate\Database\Eloquent\Collection|static[]
+     */
+    public function getBookParentShelves(Book $book)
+    {
+        return $this->permissionService->enforceEntityRestrictions('shelf', $book->shelves())->get();
+    }
+
     /**
      * Get the child items for a chapter sorted by priority but
      * with draft items floated to the top.