mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-06 12:02:45 +03:00
@@ -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.
|
||||
|
@@ -150,6 +150,7 @@ class BookController extends Controller
|
||||
$this->checkOwnablePermission('book-view', $book);
|
||||
|
||||
$bookChildren = $this->bookRepo->getBookChildren($book);
|
||||
$bookParentShelves = $this->bookRepo->getBookParentShelves($book);
|
||||
|
||||
Views::add($book);
|
||||
if ($request->has('shelf')) {
|
||||
@@ -161,6 +162,7 @@ class BookController extends Controller
|
||||
'book' => $book,
|
||||
'current' => $book,
|
||||
'bookChildren' => $bookChildren,
|
||||
'bookParentShelves' => $bookParentShelves,
|
||||
'activity' => Activity::entityActivity($book, 20, 1)
|
||||
]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user