0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-05-19 14:41:32 +00:00

Extracted some methods into a BookRepo

This commit is contained in:
Dan Brown 2019-09-15 23:28:23 +01:00
parent d28abf24d4
commit 60d0f96cd7
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
14 changed files with 233 additions and 173 deletions
app/Http/Controllers

View file

@ -42,7 +42,7 @@ class ChapterExportController extends Controller
*/
public function pdf(string $bookSlug, string $chapterSlug)
{
$chapter = $this->entityRepo->getBySlug('chapter', $chapterSlug, $bookSlug);
$chapter = $this->entityRepo->getEntityBySlug('chapter', $chapterSlug, $bookSlug);
$pdfContent = $this->exportService->chapterToPdf($chapter);
return $this->downloadResponse($pdfContent, $chapterSlug . '.pdf');
}
@ -57,7 +57,7 @@ class ChapterExportController extends Controller
*/
public function html(string $bookSlug, string $chapterSlug)
{
$chapter = $this->entityRepo->getBySlug('chapter', $chapterSlug, $bookSlug);
$chapter = $this->entityRepo->getEntityBySlug('chapter', $chapterSlug, $bookSlug);
$containedHtml = $this->exportService->chapterToContainedHtml($chapter);
return $this->downloadResponse($containedHtml, $chapterSlug . '.html');
}
@ -71,7 +71,7 @@ class ChapterExportController extends Controller
*/
public function plainText(string $bookSlug, string $chapterSlug)
{
$chapter = $this->entityRepo->getBySlug('chapter', $chapterSlug, $bookSlug);
$chapter = $this->entityRepo->getEntityBySlug('chapter', $chapterSlug, $bookSlug);
$chapterText = $this->exportService->chapterToPlainText($chapter);
return $this->downloadResponse($chapterText, $chapterSlug . '.txt');
}