X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ec3aeb3315db201251e48b9d3713b022e7d88188..refs/pull/2522/head:/app/Entities/Repos/BookRepo.php diff --git a/app/Entities/Repos/BookRepo.php b/app/Entities/Repos/BookRepo.php index b0ea7cb87..27d0b4075 100644 --- a/app/Entities/Repos/BookRepo.php +++ b/app/Entities/Repos/BookRepo.php @@ -1,14 +1,14 @@ orderBy($sort, $order)->paginate($count); + return Book::visible()->with('cover')->orderBy($sort, $order)->paginate($count); } /** @@ -91,6 +90,7 @@ class BookRepo { $book = new Book(); $this->baseRepo->create($book, $input); + Activity::addForEntity($book, ActivityType::BOOK_CREATE); return $book; } @@ -100,6 +100,7 @@ class BookRepo public function update(Book $book, array $input): Book { $this->baseRepo->update($book, $input); + Activity::addForEntity($book, ActivityType::BOOK_UPDATE); return $book; } @@ -113,14 +114,6 @@ class BookRepo $this->baseRepo->updateCoverImage($book, $coverImage, $removeImage); } - /** - * Update the permissions of a book. - */ - public function updatePermissions(Book $book, bool $restricted, Collection $permissions = null) - { - $this->baseRepo->updatePermissions($book, $restricted, $permissions); - } - /** * Remove a book from the system. * @throws Exception @@ -129,6 +122,8 @@ class BookRepo { $trashCan = new TrashCan(); $trashCan->softDestroyBook($book); + Activity::addForEntity($book, ActivityType::BOOK_DELETE); + $trashCan->autoClearOld(); } }