diff --git a/app/Http/Controllers/LogFilesController.php b/app/Http/Controllers/LogFilesController.php new file mode 100644 index 0000000..d0e67e1 --- /dev/null +++ b/app/Http/Controllers/LogFilesController.php @@ -0,0 +1,37 @@ +getMTime(), $b->getMTime()); + }); + + return view('log-files',compact('logFiles')); + } + + public function show($fileName) { + if (file_exists(storage_path('logs/' . $fileName))) + return response()->file(storage_path('logs/' . $fileName), ['content-type' => 'text/plain']); + + return 'Invalid file name.'; + } + + public function download($fileName) { + if (file_exists(storage_path('logs/' . $fileName))) + return response()->download(storage_path('logs/' . $fileName), env('APP_ENV') . '.' . $fileName); + + return 'Invalid file name.'; + } +} diff --git a/config/app.php b/config/app.php index ff7a3ae..ba38261 100644 --- a/config/app.php +++ b/config/app.php @@ -120,7 +120,9 @@ return [ | */ - 'log' => env('APP_LOG', 'single'), + 'log' => 'daily', + + 'log_max_files' => 30, 'log_level' => env('APP_LOG_LEVEL', 'debug'), diff --git a/resources/views/layouts/partials/top-nav.blade.php b/resources/views/layouts/partials/top-nav.blade.php index 1877403..3229672 100644 --- a/resources/views/layouts/partials/top-nav.blade.php +++ b/resources/views/layouts/partials/top-nav.blade.php @@ -55,7 +55,9 @@