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'); + } }