From a2ed1e8bdabe309f4d1b1a1f447f2f6135e95b28 Mon Sep 17 00:00:00 2001 From: anitamourya4it Date: Wed, 10 Aug 2022 10:45:09 +0530 Subject: [PATCH] fix files structure --- .../LaravelLogViewer/LaravelLogViewer.php | 19 ++++++++++++------- src/controllers/LogViewerController.php | 2 +- src/views/log.blade.php | 16 +++++++++++++--- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php b/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php index 998bd7e..8db4d27 100644 --- a/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php +++ b/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php @@ -133,6 +133,11 @@ public function getFolderName() return $this->folder; } + public function getCurrentFolder() + { + return str_replace($this->storage_path, '', $this->folder); + } + /** * @return string */ @@ -299,7 +304,7 @@ public function getFolders($folder = '') */ public function getFolderFiles($basename = false, $fullPath = false) { - $folder = $fullPath ? $this->folder : str_replace($this->storage_path, '', $this->folder); + $folder = $fullPath ? $this->folder : $this->getCurrentFolder(); return $this->getFiles($basename, $folder); } @@ -375,12 +380,12 @@ class="fa fa-folder"> ' . basename($v) . ' $file = $v; - echo '
- -        ' . $show2 . ' - -
'; +// echo '
+// +//        ' . basename($show2) . ' +// +//
'; } } diff --git a/src/controllers/LogViewerController.php b/src/controllers/LogViewerController.php index 8411642..ff3793e 100644 --- a/src/controllers/LogViewerController.php +++ b/src/controllers/LogViewerController.php @@ -64,7 +64,7 @@ public function index() 'folders' => $this->log_viewer->getFolders(), 'current_folder' => $this->log_viewer->getFolderName() ?? $this->log_viewer->getStoragePath(), 'folder_files' => $folderFiles, - 'files' => $this->log_viewer->getFiles(false), + 'files' => $this->log_viewer->getFiles(false, $this->log_viewer->getCurrentFolder()), 'current_file' => $this->log_viewer->getFileName(), 'standardFormat' => true, 'structure' => $this->log_viewer->foldersAndFiles(), diff --git a/src/views/log.blade.php b/src/views/log.blade.php index 92ede04..7dd76ee 100644 --- a/src/views/log.blade.php +++ b/src/views/log.blade.php @@ -185,15 +185,22 @@ function resetTheme() { @foreach($folders as $folder)
+ + ' . basename($storage_path) . ' + +
'; + \Rap2hpoutre\LaravelLogViewer\LaravelLogViewer::DirectoryTreeStructure( $storage_path, $structure ); ?> @endforeach - @foreach($files as $file) - - {{$file}} + {{basename($file)}} @endforeach @@ -204,6 +211,9 @@ class="list-group-item @if ($current_file == $file) llv-active @endif"> Log file >50M, please download it. @else + +

{{ str_replace($storage_path, '', $current_folder)}}

+