- session()->flash('success', trans('entities.revision_delete_success'));
- return view('pages/revisions', ['page' => $page, 'book' => $page->book, 'current' => $page]);
- }
-
- /**
- * Exports a page to a PDF.
- * https://github.com/barryvdh/laravel-dompdf
- * @param string $bookSlug
- * @param string $pageSlug
- * @return \Illuminate\Http\Response
- */
- public function exportPdf($bookSlug, $pageSlug)
- {
- $page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
- $page->html = $this->entityRepo->renderPage($page);
- $pdfContent = $this->exportService->pageToPdf($page);
- return $this->downloadResponse($pdfContent, $pageSlug . '.pdf');
- }
-
- /**
- * Export a page to a self-contained HTML file.
- * @param string $bookSlug
- * @param string $pageSlug
- * @return \Illuminate\Http\Response
- */
- public function exportHtml($bookSlug, $pageSlug)
- {
- $page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
- $page->html = $this->entityRepo->renderPage($page);
- $containedHtml = $this->exportService->pageToContainedHtml($page);
- return $this->downloadResponse($containedHtml, $pageSlug . '.html');
- }
-
- /**
- * Export a page to a simple plaintext .txt file.
- * @param string $bookSlug
- * @param string $pageSlug
- * @return \Illuminate\Http\Response
- */
- public function exportPlainText($bookSlug, $pageSlug)
- {
- $page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
- $pageText = $this->exportService->pageToPlainText($page);
- return $this->downloadResponse($pageText, $pageSlug . '.txt');
- }
-
- /**
- * Show a listing of recently created pages
- * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
- */
- public function showRecentlyCreated()
- {
- $pages = $this->entityRepo->getRecentlyCreatedPaginated('page', 20)->setPath(baseUrl('/pages/recently-created'));
- return view('pages/detailed-listing', [
- 'title' => trans('entities.recently_created_pages'),
- 'pages' => $pages
- ]);