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:
parent
d28abf24d4
commit
60d0f96cd7
14 changed files with 233 additions and 173 deletions
app/Http/Controllers
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue