Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7e74ae6b0f | ||
|
c57f7ff2f9 | ||
|
d2a4f06b6a | ||
|
5c801cdb27 | ||
|
d8006be928 | ||
|
7995091b38 | ||
|
8224a1f704 | ||
|
d43ee5a6bd | ||
|
313a1c5c8e | ||
|
eb0d72ffc8 | ||
|
5241eaa11b | ||
|
9f9bf0af6c | ||
|
d65ff46fef | ||
|
5396f8d6de | ||
|
317d46abea |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.idea
|
27
README.md
27
README.md
@ -1,20 +1,3 @@
|
|||||||
<div align="center">
|
|
||||||
|
|
||||||
# Dcat Laravel Log Viewer
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<a href="https://github.com/jqhph/laravel-log-viewer/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-7389D8.svg?style=flat" ></a>
|
|
||||||
<a href="https://styleci.io/repos/215738797">
|
|
||||||
<img src="https://github.styleci.io/repos/215738797/shield" alt="StyleCI">
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/jqhph/laravel-log-viewer/releases" ><img src="https://img.shields.io/github/release/jqhph/laravel-log-viewer.svg?color=4099DE" /></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
`Dcat Log Viewer`是一个`Laravel`日志查看工具,支持大文件日志的查看和搜索功能,更改自[laravel-admin-extensions/log-viewer](https://github.com/laravel-admin-extensions/log-viewer)。
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## 功能
|
## 功能
|
||||||
|
|
||||||
@ -36,16 +19,16 @@
|
|||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer require dcat/laravel-log-viewer
|
composer require zyimm/laravel-log-viewer
|
||||||
```
|
```
|
||||||
|
|
||||||
发布配置文件,此步骤可省略
|
发布配置文件,此步骤可省略
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
php artisan vendor:publish --tag=dcat-log-viewer
|
php artisan vendor:publish --tag=zyimm-log-viewer
|
||||||
```
|
```
|
||||||
|
|
||||||
然后访问 `http://hostname/dcat-logs` 即可
|
然后访问 `http://hostname/zyimm-logs` 即可
|
||||||
|
|
||||||
配置文件
|
配置文件
|
||||||
|
|
||||||
@ -54,9 +37,9 @@ php artisan vendor:publish --tag=dcat-log-viewer
|
|||||||
return [
|
return [
|
||||||
'route' => [
|
'route' => [
|
||||||
// 路由前缀
|
// 路由前缀
|
||||||
'prefix' => 'dcat-logs',
|
'prefix' => 'zyimm-logs',
|
||||||
// 命名空间
|
// 命名空间
|
||||||
'namespace' => 'Dcat\LogViewer',
|
'namespace' => 'Zyimm\LogViewer',
|
||||||
// 中间件
|
// 中间件
|
||||||
'middleware' => [],
|
'middleware' => [],
|
||||||
],
|
],
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "dcat/laravel-log-viewer",
|
"name": "zyimm/laravel-log-viewer",
|
||||||
"description": "Laravel Log Viewer",
|
"description": "Laravel Log Viewer",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"keywords": ["laravel", "log viewer"],
|
"keywords": ["laravel", "log viewer"],
|
||||||
"homepage": "https://github.com/jqhph/laravel-log-viewer",
|
"homepage": "http://gogs.zyimm.com/zyimm/laravel-log-viewer",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "jqh",
|
"name": "zyimm",
|
||||||
"email": "841324345@qq.com"
|
"email": "zyimm@qq.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
@ -16,13 +16,13 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Dcat\\LogViewer\\": "src/"
|
"Zyimm\\LogViewer\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
"providers": [
|
||||||
"Dcat\\LogViewer\\DcatLogViewerServiceProvider"
|
"Zyimm\\LogViewer\\LogViewerServiceProvider"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'route' => [
|
'route' => [
|
||||||
'prefix' => 'dcat-logs',
|
'prefix' => 'zyimm-logs',
|
||||||
'namespace' => 'Dcat\LogViewer',
|
'namespace' => 'Zyimm\LogViewer',
|
||||||
'middleware' => [],
|
'middleware' => [],
|
||||||
],
|
],
|
||||||
|
|
@ -5,13 +5,12 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<title>Laravel log viewer</title>
|
<title>Laravel log viewer</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
|
|
||||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
<script src="https://cdn.bootcdn.net/ajax/libs/html5shiv/r29/html5.min.js"></script>
|
||||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
<script src="https://cdn.bootcdn.net/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
@ -27,7 +26,7 @@
|
|||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 20px;
|
font-size: 18px;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +214,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav>li>a.dir {
|
.nav>li>a.dir {
|
||||||
font-size: 1.1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@ -228,25 +227,25 @@
|
|||||||
|
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
Dcat Log Viewer
|
Zyimm Log Viewer
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h3 class="box-title"><i class="fa fa-folder-open-o"></i>
|
<h3 class="box-title"><i class="fa fa-folder-open-o"></i>
|
||||||
<a href="{{ route('dcat-log-viewer') }}">logs</a>
|
<a href="{{ route('zyimm-log-viewer') }}">logs</a>
|
||||||
@if($dir)
|
@if($dir)
|
||||||
@php($tmp = '')
|
@php($tmp = '')
|
||||||
@foreach(explode('/', $dir) as $v)
|
@foreach(explode('/', $dir) as $v)
|
||||||
@php($tmp .= '/'.$v)
|
@php($tmp .= '/'.$v)
|
||||||
/
|
/
|
||||||
<a href="{{ route('dcat-log-viewer', ['dir' => trim($tmp, '/')])}}">{{ $v }}</a>
|
<a href="{{ route('zyimm-log-viewer', ['dir' => trim($tmp, '/')])}}">{{ $v }}</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form action="{{ route('dcat-log-viewer') }}" style="display: inline-block;width: 220px;padding-left: 15px">
|
<form action="{{ route('zyimm-log-viewer') }}" style="display: inline-block;width: 220px;padding-left: 15px">
|
||||||
<div class="input-group-sm" style="display: inline-block;width: 100%">
|
<div class="input-group-sm" style="display: inline-block;width: 100%">
|
||||||
<input name="filename" class="form-control" value="{{ app('request')->get('filename') }}" type="text" placeholder="Search..." />
|
<input name="filename" class="form-control" value="{{ app('request')->get('filename') }}" type="text" placeholder="Search..." />
|
||||||
</div>
|
</div>
|
||||||
@ -257,8 +256,8 @@
|
|||||||
@if(! app('request')->get('filename'))
|
@if(! app('request')->get('filename'))
|
||||||
@foreach($logDirs as $d)
|
@foreach($logDirs as $d)
|
||||||
<li @if($d === $fileName) class="active" @endif>
|
<li @if($d === $fileName) class="active" @endif>
|
||||||
<a class="dir" href="{{ route('dcat-log-viewer', ['dir' => $d]) }}">
|
<a class="dir" href="{{ route('zyimm-log-viewer', ['dir' => $d]) }}">
|
||||||
<i class="fa fa-folder-o"></i>{{ $d }}
|
<i class="fa fa-folder-o"></i>{{ basename($d) }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
@ -284,7 +283,7 @@
|
|||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<div class="box box-primary">
|
<div class="box box-primary">
|
||||||
<div class="box-header with-border">
|
<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('zyimm-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>--}}
|
{{-- <button class="btn btn-default btn-sm download"><i class="fa-trash-o fa"></i> {{ trans('Delete') }}</button>--}}
|
||||||
|
|
||||||
@ -333,7 +332,7 @@
|
|||||||
@foreach($logs as $index => $log)
|
@foreach($logs as $index => $log)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $index + 1 }}</td>
|
<td>{{ $index + 1 }}</td>
|
||||||
<td><span class="label bg-{{\Dcat\LogViewer\LogViewer::$levelColors[$log['level']]}}">{{ $log['level'] }}</span></td>
|
<td><span class="label bg-{{\Zyimm\LogViewer\LogViewer::$levelColors[$log['level']]}}">{{ $log['level'] }}</span></td>
|
||||||
<td><strong>{{ $log['env'] }}</strong></td>
|
<td><strong>{{ $log['env'] }}</strong></td>
|
||||||
<td style="width:150px;">{{ $log['time'] }}</td>
|
<td style="width:150px;">{{ $log['time'] }}</td>
|
||||||
<td><pre>{{ $log['info'] }}</pre></td>
|
<td><pre>{{ $log['info'] }}</pre></td>
|
||||||
@ -388,7 +387,6 @@
|
|||||||
<!-- jQuery for Bootstrap -->
|
<!-- jQuery for Bootstrap -->
|
||||||
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||||
{{--<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>--}}
|
{{--<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>--}}
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Dcat\LogViewer;
|
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
|
|
||||||
class DcatLogViewerServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
$this->loadViewsFrom(__DIR__.'/../resources/view', 'dcat-log-viewer');
|
|
||||||
|
|
||||||
if ($this->app->runningInConsole()) {
|
|
||||||
$this->publishes([__DIR__.'/../config' => config_path()], 'dcat-log-viewer');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->registerRoutes();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function registerRoutes()
|
|
||||||
{
|
|
||||||
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->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',]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Dcat\LogViewer;
|
namespace Zyimm\LogViewer;
|
||||||
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@ -14,14 +14,14 @@ class LogController
|
|||||||
$filename = trim($request->get('filename'));
|
$filename = trim($request->get('filename'));
|
||||||
$offset = $request->get('offset');
|
$offset = $request->get('offset');
|
||||||
$keyword = trim($request->get('keyword'));
|
$keyword = trim($request->get('keyword'));
|
||||||
$lines = $keyword ? (config('dcat-log-viewer.search_page_items') ?: 500) : (config('dcat-log-viewer.page_items') ?: 30);
|
$lines = $keyword ? (config('zyimm-log-viewer.search_page_items') ?: 500) : (config('zyimm-log-viewer.page_items') ?: 30);
|
||||||
|
|
||||||
$viewer = new LogViewer($this->getDirectory(), $dir, $file);
|
$viewer = new LogViewer($this->getDirectory(), $dir, $file);
|
||||||
|
|
||||||
$viewer->setKeyword($keyword);
|
$viewer->setKeyword($keyword);
|
||||||
$viewer->setFilename($filename);
|
$viewer->setFilename($filename);
|
||||||
|
|
||||||
return view('dcat-log-viewer::log', [
|
return view('zyimm-log-viewer::log', [
|
||||||
'dir' => $dir,
|
'dir' => $dir,
|
||||||
'logs' => $viewer->fetch($offset, $lines),
|
'logs' => $viewer->fetch($offset, $lines),
|
||||||
'logFiles' => $this->formatLogFiles($viewer, $dir),
|
'logFiles' => $this->formatLogFiles($viewer, $dir),
|
||||||
@ -35,16 +35,26 @@ class LogController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function download($file = null)
|
public function download()
|
||||||
{
|
{
|
||||||
$viewer = new LogViewer($this->getDirectory(), request('dir'), $file);
|
$request = app('request');
|
||||||
|
|
||||||
|
$file = trim($request->get('file'));
|
||||||
|
$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());
|
return response()->download($viewer->getFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getDirectory()
|
protected function getDirectory()
|
||||||
{
|
{
|
||||||
return config('dcat-log-viewer.directory') ?: storage_path('logs');
|
return config('zyimm-log-viewer.directory') ?: storage_path('logs');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function formatLogFiles(LogViewer $logViewer, $currentDir)
|
protected function formatLogFiles(LogViewer $logViewer, $currentDir)
|
||||||
@ -63,7 +73,7 @@ class LogController
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'file' => $value,
|
'file' => $value,
|
||||||
'url' => route('dcat-log-viewer.file', ['file' => $file, 'dir' => $dir]),
|
'url' => route('zyimm-log-viewer.file', ['file' => $file, 'dir' => $dir]),
|
||||||
'active' => $logViewer->isCurrentFile($value),
|
'active' => $logViewer->isCurrentFile($value),
|
||||||
];
|
];
|
||||||
}, $logViewer->getLogFiles());
|
}, $logViewer->getLogFiles());
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Dcat\LogViewer;
|
namespace Zyimm\LogViewer;
|
||||||
|
|
||||||
use Illuminate\Filesystem\Filesystem;
|
use Illuminate\Filesystem\Filesystem;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@ -73,12 +73,38 @@ class LogViewer
|
|||||||
*/
|
*/
|
||||||
public function __construct($basePath, $dir, $file = null)
|
public function __construct($basePath, $dir, $file = null)
|
||||||
{
|
{
|
||||||
$this->basePath = rtrim($basePath, '/');
|
$this->basePath = $this->getRealPath(rtrim($basePath, '/'));
|
||||||
$this->currentDirectory = rtrim($dir, '/');
|
$this->currentDirectory = $this->formatPath(rtrim($dir, '/'));
|
||||||
$this->file = $file;
|
$this->file = $this->formatPath($file);
|
||||||
$this->files = new Filesystem();
|
$this->files = new Filesystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getRealPath($path)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$paths = explode('/', $path);
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
foreach ($paths as $v) {
|
||||||
|
$result .= $v.'/';
|
||||||
|
|
||||||
|
$current = rtrim($result, '/');
|
||||||
|
if (is_link($current)) {
|
||||||
|
$result = readlink($current).'/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rtrim($result, '/');
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function formatPath($path)
|
||||||
|
{
|
||||||
|
return str_replace(['../'], '', $path);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get file path by giving log file name.
|
* Get file path by giving log file name.
|
||||||
*
|
*
|
||||||
@ -103,7 +129,7 @@ class LogViewer
|
|||||||
|
|
||||||
public function setFilename($value)
|
public function setFilename($value)
|
||||||
{
|
{
|
||||||
$this->filename = $value;
|
$this->filename = $this->formatPath($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,10 +162,10 @@ class LogViewer
|
|||||||
}
|
}
|
||||||
|
|
||||||
$files = glob($this->mergeDirectory().'/*.*');
|
$files = glob($this->mergeDirectory().'/*.*');
|
||||||
$files = array_combine($files, array_map('filemtime', $files));
|
//$files = array_combine($files, array_map('filemtime', $files));
|
||||||
arsort($files);
|
rsort($files);
|
||||||
|
|
||||||
return array_map('basename', array_keys($files));
|
return array_map('basename', $files);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLogDirectories()
|
public function getLogDirectories()
|
||||||
@ -210,7 +236,7 @@ class LogViewer
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return route('dcat-log-viewer.file', [
|
return route('zyimm-log-viewer.file', [
|
||||||
'file' => $this->getFile(),
|
'file' => $this->getFile(),
|
||||||
'offset' => $this->pageOffset['end'],
|
'offset' => $this->pageOffset['end'],
|
||||||
'keyword' => $this->keyword,
|
'keyword' => $this->keyword,
|
||||||
@ -234,7 +260,7 @@ class LogViewer
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return route('dcat-log-viewer.file', [
|
return route('zyimm-log-viewer.file', [
|
||||||
'file' => $this->getFile(),
|
'file' => $this->getFile(),
|
||||||
'offset' => -$this->pageOffset['start'],
|
'offset' => -$this->pageOffset['start'],
|
||||||
'keyword' => $this->keyword,
|
'keyword' => $this->keyword,
|
||||||
|
32
src/LogViewerServiceProvider.php
Normal file
32
src/LogViewerServiceProvider.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Zyimm\LogViewer;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class LogViewerServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->loadViewsFrom(__DIR__.'/../resources/view', 'zyimm-log-viewer');
|
||||||
|
|
||||||
|
if ($this->app->runningInConsole()) {
|
||||||
|
$this->publishes([__DIR__.'/../config' => config_path()], 'zyimm-log-viewer');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->registerRoutes();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function registerRoutes()
|
||||||
|
{
|
||||||
|
app('router')->group([
|
||||||
|
'prefix' => config('zyimm-log-viewer.route.prefix', 'zyimm-logs'),
|
||||||
|
'namespace' => config('zyimm-log-viewer.route.namespace', 'Zyimm\LogViewer'),
|
||||||
|
'middleware' => config('zyimm-log-viewer.route.middleware'),
|
||||||
|
], function ($router) {
|
||||||
|
$router->get('/', ['as' => 'zyimm-log-viewer', 'uses' => 'LogController@index',]);
|
||||||
|
$router->get('download', ['as' => 'zyimm-log-viewer.download', 'uses' => 'LogController@download',]);
|
||||||
|
$router->get('{file}', ['as' => 'zyimm-log-viewer.file', 'uses' => 'LogController@index',]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user