Skip to content

Commit 7eccaae

Browse files
committed
Delete logs
1 parent a226072 commit 7eccaae

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/controllers/LogViewerController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ public function index()
1414

1515
if (\Input::get('dl')) {
1616
return \Response::download(storage_path() . '/logs/' . base64_decode(\Input::get('dl')));
17+
} elseif (\Input::has('del')) {
18+
\File::delete(storage_path() . '/logs/' . base64_decode(\Input::get('del')));
19+
return \Redirect::to(\Request::url());
1720
}
1821

1922
$logs = LaravelLogViewer::all();

src/views/log.blade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494
@endif
9595
<div>
9696
<a href="?dl={{ base64_encode($current_file) }}"><span class="glyphicon glyphicon-download-alt"></span> Download file</a>
97+
-
98+
<a id="delete-log" href="?del={{ base64_encode($current_file) }}"><span class="glyphicon glyphicon-trash"></span> Delete file</a>
9799
</div>
98100
</div>
99101
</div>
@@ -119,6 +121,9 @@
119121
$('.table-container').on('click', '.expand', function(){
120122
$('#' + $(this).data('display')).toggle();
121123
});
124+
$('#delete-log').click(function(){
125+
return confirm('Are you sure?');
126+
});
122127
});
123128
</script>
124129
</body>

0 commit comments

Comments
 (0)