/** * Destroy the given book. * @param Book $book * @throws \Exception */ public function destroy(Book $book) { foreach ($book->pages as $page) { $this->pageRepo->destroy($page); } foreach ($book->chapters as $chapter) { $this->chapterRepo->destroy($chapter); } $book->views()->delete(); $book->permissions()->delete(); $this->permissionService->deleteJointPermissionsForEntity($book); $book->delete(); }