File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -28,12 +28,15 @@ public function index()
2828 } elseif ($ this ->request ->has ('del ' )) {
2929 app ('files ' )->delete (LaravelLogViewer::pathToLogFile (base64_decode ($ this ->request ->input ('del ' ))));
3030 return $ this ->redirect ($ this ->request ->url ());
31+ } elseif ($ this ->request ->has ('delall ' )){
32+ foreach (LaravelLogViewer::getFiles (true ) as $ file ){
33+ app ('files ' )->delete (LaravelLogViewer::pathToLogFile ($ file ));
34+ }
35+ return $ this ->redirect ($ this ->request ->url ());
3136 }
3237
33- $ logs = LaravelLogViewer::all ();
34-
3538 return app ('view ' )->make ('laravel-log-viewer::log ' , [
36- 'logs ' => $ logs ,
39+ 'logs ' => LaravelLogViewer:: all () ,
3740 'files ' => LaravelLogViewer::getFiles (true ),
3841 'current_file ' => LaravelLogViewer::getFileName ()
3942 ]);
Original file line number Diff line number Diff line change 9191 </table >
9292 @endif
9393 <div >
94- <a href =" ?dl={{ base64_encode ($current_file ) } }" ><span class =" glyphicon glyphicon-download-alt" ></span > Download file</a >
95- -
96- <a id =" delete-log" href =" ?del={{ base64_encode ($current_file ) } }" ><span class =" glyphicon glyphicon-trash" ></span > Delete file</a >
94+ @if ($current_file )
95+ <a href =" ?dl={{ base64_encode ($current_file ) } }" ><span class =" glyphicon glyphicon-download-alt" ></span > Download file</a >
96+ -
97+ <a id =" delete-log" href =" ?del={{ base64_encode ($current_file ) } }" ><span class =" glyphicon glyphicon-trash" ></span > Delete file</a >
98+ @if (count ($files ) > 1 )
99+ -
100+ <a id =" delete-all-log" href =" ?delall=true" ><span class =" glyphicon glyphicon-trash" ></span > Delete all files</a >
101+ @endif
102+ @endif
97103 </div >
98104 </div >
99105 </div >
119125 $ (' .table-container' ).on (' click' , ' .expand' , function (){
120126 $ (' #' + $ (this ).data (' display' )).toggle ();
121127 });
122- $ (' #delete-log' ).click (function (){
128+ $ (' #delete-log, #delete-all-log ' ).click (function (){
123129 return confirm (' Are you sure?' );
124130 });
125131 });
You can’t perform that action at this time.
0 commit comments