]>
BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Api/BookExportApiController.php
projects
/
bookstack
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #3556 from GongMingCai/development
[bookstack]
/
app
/
Http
/
Controllers
/
Api
/
BookExportApiController.php
diff --git
a/app/Http/Controllers/Api/BookExportApiController.php
b/app/Http/Controllers/Api/BookExportApiController.php
index c7d121f88636cec083594f2c5f376eb2f6e273b8..84090befba53249284e267bf77d767d88888cecb 100644
(file)
--- a/
app/Http/Controllers/Api/BookExportApiController.php
+++ b/
app/Http/Controllers/Api/BookExportApiController.php
@@
-13,6
+13,7
@@
class BookExportApiController extends ApiController
public function __construct(ExportFormatter $exportFormatter)
{
$this->exportFormatter = $exportFormatter;
public function __construct(ExportFormatter $exportFormatter)
{
$this->exportFormatter = $exportFormatter;
+ $this->middleware('can:content-export');
}
/**
}
/**
@@
-25,7
+26,7
@@
class BookExportApiController extends ApiController
$book = Book::visible()->findOrFail($id);
$pdfContent = $this->exportFormatter->bookToPdf($book);
$book = Book::visible()->findOrFail($id);
$pdfContent = $this->exportFormatter->bookToPdf($book);
- return $this->download
Response
($pdfContent, $book->slug . '.pdf');
+ return $this->download
()->directly
($pdfContent, $book->slug . '.pdf');
}
/**
}
/**
@@
-38,7
+39,7
@@
class BookExportApiController extends ApiController
$book = Book::visible()->findOrFail($id);
$htmlContent = $this->exportFormatter->bookToContainedHtml($book);
$book = Book::visible()->findOrFail($id);
$htmlContent = $this->exportFormatter->bookToContainedHtml($book);
- return $this->download
Response
($htmlContent, $book->slug . '.html');
+ return $this->download
()->directly
($htmlContent, $book->slug . '.html');
}
/**
}
/**
@@
-49,7
+50,7
@@
class BookExportApiController extends ApiController
$book = Book::visible()->findOrFail($id);
$textContent = $this->exportFormatter->bookToPlainText($book);
$book = Book::visible()->findOrFail($id);
$textContent = $this->exportFormatter->bookToPlainText($book);
- return $this->download
Response
($textContent, $book->slug . '.txt');
+ return $this->download
()->directly
($textContent, $book->slug . '.txt');
}
/**
}
/**
@@
-60,6
+61,6
@@
class BookExportApiController extends ApiController
$book = Book::visible()->findOrFail($id);
$markdown = $this->exportFormatter->bookToMarkdown($book);
$book = Book::visible()->findOrFail($id);
$markdown = $this->exportFormatter->bookToMarkdown($book);
- return $this->download
Response
($markdown, $book->slug . '.md');
+ return $this->download
()->directly
($markdown, $book->slug . '.md');
}
}
}
}