Skip to content

Commit

Permalink
stream download
Browse files Browse the repository at this point in the history
  • Loading branch information
rap2hpoutre committed Sep 5, 2018
1 parent a00433f commit c87837f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Exportable.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ public function export($path, callable $callback = null)
* @throws \Box\Spout\Common\Exception\UnsupportedTypeException
* @throws \Box\Spout\Writer\Exception\WriterNotOpenedException
*
* @return string
* @return \Symfony\Component\HttpFoundation\StreamedResponse|string
*/
public function download($path, callable $callback = null)
{
if (method_exists(response(), 'streamDownload')) {
return response()->streamDownload(function() {
self::exportOrDownload($path, 'openToBrowser', $callback);
});
}
self::exportOrDownload($path, 'openToBrowser', $callback);

return '';
}

Expand Down

0 comments on commit c87837f

Please sign in to comment.