namespace BookStack\Http\Controllers;
use Activity;
+use BookStack\Actions\ActivityQueries;
use BookStack\Actions\ActivityType;
use BookStack\Actions\View;
use BookStack\Entities\Models\Bookshelf;
if ($bookshelf) {
$bookshelf->appendBook($book);
- Activity::addForEntity($bookshelf, ActivityType::BOOKSHELF_UPDATE);
+ Activity::add(ActivityType::BOOKSHELF_UPDATE, $bookshelf);
}
return redirect($book->getUrl());
/**
* Display the specified book.
*/
- public function show(Request $request, string $slug)
+ public function show(Request $request, ActivityQueries $activities, string $slug)
{
$book = $this->bookRepo->getBySlug($slug);
$bookChildren = (new BookContents($book))->getTree(true);
- $bookParentShelves = $book->shelves()->visible()->get();
+ $bookParentShelves = $book->shelves()->scopes('visible')->get();
View::incrementFor($book);
if ($request->has('shelf')) {
'current' => $book,
'bookChildren' => $bookChildren,
'bookParentShelves' => $bookParentShelves,
- 'activity' => Activity::entityActivity($book, 20, 1),
+ 'activity' => $activities->entityActivity($book, 20, 1),
]);
}