Files
faveo/app/FaveoLog/controllers/LogViewerController.php
Shift cade5f0d23 Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
2023-01-07 18:47:35 +00:00

39 lines
1.1 KiB
PHP

<?php
namespace App\FaveoLog\controllers;
use App\FaveoLog\LaravelLogViewer;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\View;
class LogViewerController extends Controller
{
public function index()
{
if (Request::input('l')) {
//dd(base64_decode(Request::input('l')));
LaravelLogViewer::setFile(base64_decode(Request::input('l')));
}
if (Request::input('dl')) {
return Response::download(LaravelLogViewer::pathToLogFile(base64_decode(Request::input('dl'))));
} elseif (Request::has('del')) {
File::delete(LaravelLogViewer::pathToLogFile(base64_decode(Request::input('del'))));
return Redirect::to(Request::url());
}
$logs = LaravelLogViewer::all();
return View::make('log::log', [
'logs' => $logs,
'files' => LaravelLogViewer::getFiles(true),
'current_file' => LaravelLogViewer::getFileName(),
]);
}
}