1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Show bookshelves that a book belongs to on a book view

Closes #1598
This commit is contained in:
Christopher Wilkinson
2019-09-27 00:45:10 +01:00
parent 7cd956b24b
commit 4ad4dfa55a
5 changed files with 52 additions and 3 deletions

View 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.