update
This commit is contained in:
parent
2ed3d0a624
commit
4c77f96f24
|
@ -248,13 +248,13 @@
|
|||
|
||||
<form action="{{ route('dcat-log-viewer') }}" style="display: inline-block;width: 220px;padding-left: 15px">
|
||||
<div class="input-group-sm" style="display: inline-block;width: 100%">
|
||||
<input name="filename" class="form-control" value="{{ request('filename') }}" type="text" placeholder="Search..." />
|
||||
<input name="filename" class="form-control" value="{{ app('request')->get('filename') }}" type="text" placeholder="Search..." />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="box-body no-padding">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
@if(! request('filename'))
|
||||
@if(! app('request')->get('filename'))
|
||||
@foreach($logDirs as $d)
|
||||
<li @if($d === $fileName) class="active" @endif>
|
||||
<a class="dir" href="{{ route('dcat-log-viewer', ['dir' => $d]) }}">
|
||||
|
@ -284,18 +284,18 @@
|
|||
<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> {{ __('Download') }}</a>
|
||||
<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>
|
||||
|
||||
{{-- <button class="btn btn-default btn-sm download"><i class="fa-trash-o fa"></i> {{ __('Delete') }}</button>--}}
|
||||
{{-- <button class="btn btn-default btn-sm download"><i class="fa-trash-o fa"></i> {{ trans('Delete') }}</button>--}}
|
||||
|
||||
<form style="display: inline-block;width: 180px">
|
||||
<div class="input-group-sm" style="display: inline-block;width: 100%">
|
||||
<input name="keyword" class="form-control" value="{{ request('keyword') }}" type="text" placeholder="Search..." />
|
||||
<input name="keyword" class="form-control" value="{{ app('request')->get('keyword') }}" type="text" placeholder="Search..." />
|
||||
</div>
|
||||
</form>
|
||||
<div class="float-right">
|
||||
<a class=""><strong>Size:</strong> {{ $size }} <strong>Updated at:</strong>
|
||||
{{ \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', date('Y-m-d H:i:s', filectime($filePath)))->diffForHumans() }}</a>
|
||||
{{ date('Y-m-d H:i:s', filectime($filePath)) }}</a>
|
||||
|
||||
<div class="btn-group">
|
||||
@if ($prevUrl)
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace Dcat\LogViewer;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class DcatLogViewerServiceProvider extends ServiceProvider
|
||||
|
@ -21,14 +19,14 @@ class DcatLogViewerServiceProvider extends ServiceProvider
|
|||
|
||||
protected function registerRoutes()
|
||||
{
|
||||
Route::group([
|
||||
app('router')->group([
|
||||
'prefix' => config('dcat-log-viewer.route.prefix', 'dcat-logs'),
|
||||
'namespace' => config('dcat-log-viewer.route.namespace', 'Dcat\LogViewer'),
|
||||
'middleware' => config('dcat-log-viewer.route.middleware'),
|
||||
], function (Router $router) {
|
||||
$router->get('/', 'LogController@index')->name('dcat-log-viewer');
|
||||
$router->get('{file}', 'LogController@index')->name('dcat-log-viewer.file');
|
||||
$router->get('download/{file}', 'LogController@download')->name('dcat-log-viewer.download');
|
||||
], function ($router) {
|
||||
$router->get('/', ['as' => 'dcat-log-viewer', 'uses' => 'LogController@index',]);
|
||||
$router->get('{file}', ['as' => 'dcat-log-viewer.file', 'uses' => 'LogController@index',]);
|
||||
$router->get('download/{file}', ['as' => 'dcat-log-viewer.download', 'uses' => 'LogController@download',]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ class LogController
|
|||
{
|
||||
public function index($file = null)
|
||||
{
|
||||
$dir = trim(request('dir'));
|
||||
$filename = trim(request('filename'));
|
||||
$offset = request('offset');
|
||||
$keyword = trim(request('keyword'));
|
||||
$request = app('request');
|
||||
|
||||
$dir = trim($request->get('dir'));
|
||||
$filename = trim($request->get('filename'));
|
||||
$offset = $request->get('offset');
|
||||
$keyword = trim($request->get('keyword'));
|
||||
$lines = $keyword ? (config('dcat-log-viewer.search_page_items') ?: 500) : (config('dcat-log-viewer.page_items') ?: 30);
|
||||
|
||||
$viewer = new LogViewer($this->getDirectory(), $dir, $file);
|
||||
|
|
|
@ -98,7 +98,7 @@ class LogViewer
|
|||
|
||||
public function setKeyword($value)
|
||||
{
|
||||
$this->keyword = $value;
|
||||
$this->keyword = strtolower($value);
|
||||
}
|
||||
|
||||
public function setFilename($value)
|
||||
|
@ -261,7 +261,7 @@ class LogViewer
|
|||
$result = [];
|
||||
|
||||
foreach ($logs as $log) {
|
||||
if (Str::contains(implode(' ', $log), $this->keyword)) {
|
||||
if (Str::contains(strtolower(implode(' ', $log)), $this->keyword)) {
|
||||
$result[] = $log;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user