From 86b9c715934716757f95af9395593317841ef0eb Mon Sep 17 00:00:00 2001 From: Jimmy Setiawan Date: Mon, 26 Nov 2018 18:50:22 +0700 Subject: [PATCH] Add support for lumen --- src/Lumen.php | 27 +++++++++++++++++++++++++++ src/ServiceProvider.php | 8 ++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/Lumen.php diff --git a/src/Lumen.php b/src/Lumen.php new file mode 100644 index 0000000..23a6c99 --- /dev/null +++ b/src/Lumen.php @@ -0,0 +1,27 @@ +basePath() . '/config' . ($path ? '/' . $path : $path); + } +} + +if (! function_exists('public_path')) { + /** + * Return the path to public dir. + * + * @param null $path + * @return string + */ + function public_path($path = null) + { + return rtrim(app()->basePath('public/' . $path), '/'); + } +} diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 8ce5902..6276a2f 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -42,6 +42,10 @@ public function register() public function boot() { + if ($this->isLumen()) { + require_once 'Lumen.php'; + } + $this->loadViewsFrom(__DIR__ . '/views', 'laravel-report-generator'); $this->publishes([ @@ -73,4 +77,8 @@ public function provides() return []; } + protected function isLumen() + { + return str_contains($this->app->version(), 'Lumen'); + } }