From 579586e3e49a299334b29447484df4f3087ff325 Mon Sep 17 00:00:00 2001 From: Iftekhar Rifat Date: Thu, 15 Dec 2016 22:00:12 +0600 Subject: [PATCH] Fix laravel 4.2 compatibility --- src/controllers/LogViewerController.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/controllers/LogViewerController.php b/src/controllers/LogViewerController.php index 1ef59f3..c6cc417 100644 --- a/src/controllers/LogViewerController.php +++ b/src/controllers/LogViewerController.php @@ -24,7 +24,7 @@ public function index() } if ($this->request->input('dl')) { - return response()->download(LaravelLogViewer::pathToLogFile(base64_decode($this->request->input('dl')))); + return $this->download(LaravelLogViewer::pathToLogFile(base64_decode($this->request->input('dl')))); } elseif ($this->request->has('del')) { app('files')->delete(LaravelLogViewer::pathToLogFile(base64_decode($this->request->input('del')))); return $this->redirect($this->request->url()); @@ -47,4 +47,14 @@ private function redirect($to) return app('redirect')->to($to); } + + private function download($data) + { + if (function_exists('response')) { + return response()->download($data); + } + + // For laravel 4.2 + return app('\Illuminate\Support\Facades\Response')->download($data); + } }