namespace BookStack\Http\Controllers;
use BookStack\Entities\ExportService;
-use BookStack\Entities\Repos\EntityRepo;
+use BookStack\Entities\Repos\BookRepo;
use BookStack\Exceptions\NotFoundException;
use Throwable;
class BookExportController extends Controller
{
/**
- * @var EntityRepo
+ * @var BookRepo
*/
- protected $entityRepo;
+ protected $bookRepo;
/**
* @var ExportService
/**
* BookExportController constructor.
- * @param EntityRepo $entityRepo
+ * @param BookRepo $bookRepo
* @param ExportService $exportService
*/
- public function __construct(EntityRepo $entityRepo, ExportService $exportService)
+ public function __construct(BookRepo $bookRepo, ExportService $exportService)
{
- $this->entityRepo = $entityRepo;
+ $this->bookRepo = $bookRepo;
$this->exportService = $exportService;
parent::__construct();
}
*/
public function pdf(string $bookSlug)
{
- $book = $this->entityRepo->getBySlug('book', $bookSlug);
+ $book = $this->bookRepo->getBySlug($bookSlug);
$pdfContent = $this->exportService->bookToPdf($book);
return $this->downloadResponse($pdfContent, $bookSlug . '.pdf');
}
*/
public function html(string $bookSlug)
{
- $book = $this->entityRepo->getBySlug('book', $bookSlug);
+ $book = $this->bookRepo->getBySlug($bookSlug);
$htmlContent = $this->exportService->bookToContainedHtml($book);
return $this->downloadResponse($htmlContent, $bookSlug . '.html');
}
*/
public function plainText(string $bookSlug)
{
- $book = $this->entityRepo->getBySlug('book', $bookSlug);
+ $book = $this->bookRepo->getBySlug($bookSlug);
$textContent = $this->exportService->bookToPlainText($book);
return $this->downloadResponse($textContent, $bookSlug . '.txt');
}