- $page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
- $containedHtml = $this->exportService->pageToPlainText($page);
- return response()->make($containedHtml, 200, [
- 'Content-Type' => 'application/octet-stream',
- 'Content-Disposition' => 'attachment; filename="' . $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
- ]);
+ $page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
+ $pageText = $this->exportService->pageToPlainText($page);
+ return $this->downloadResponse($pageText, $pageSlug . '.txt');