BookStack\Repos\BookRepo::destroy PHP Method

destroy() public method

Destroy the given book.
public destroy ( Book $book )
$book BookStack\Book
    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();
    }