wip download

This commit is contained in:
jqh 2020-07-13 11:06:51 +08:00
parent 994219f47e
commit 317d46abea
2 changed files with 11 additions and 2 deletions

View File

@ -284,7 +284,7 @@
<div class="col-md-10">
<div class="box box-primary">
<div class="box-header with-border">
<a href="{{ route('dcat-log-viewer.download', ['dir' => $dir, 'file' => $fileName]) }}" class="btn btn-primary btn-sm download" style="color: #fff"><i class="fa-download fa"></i> {{ trans('Download') }}</a>
<a href="{{ route('dcat-log-viewer.download', ['dir' => $dir, 'file' => $fileName, 'filename' => app('request')->get('filename')]) }}" class="btn btn-primary btn-sm download" style="color: #fff"><i class="fa-download fa"></i> {{ trans('Download') }}</a>
{{-- <button class="btn btn-default btn-sm download"><i class="fa-trash-o fa"></i> {{ trans('Delete') }}</button>--}}
&nbsp;

View File

@ -37,7 +37,16 @@ class LogController
public function download($file = null)
{
$viewer = new LogViewer($this->getDirectory(), request('dir'), $file);
$request = app('request');
$dir = trim($request->get('dir'));
$filename = trim($request->get('filename'));
$keyword = trim($request->get('keyword'));
$viewer = new LogViewer($this->getDirectory(), $dir, $file);
$viewer->setKeyword($keyword);
$viewer->setFilename($filename);
return response()->download($viewer->getFilePath());
}