Skip to content

Commit

Permalink
Add support for lumen
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy-JS committed Nov 26, 2018
1 parent 51234b0 commit 86b9c71
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Lumen.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

if (! function_exists('config_path')) {
/**
* Get the configuration path.
*
* @param string $path
* @return string
*/
function config_path($path = '')
{
return app()->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), '/');
}
}
8 changes: 8 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -73,4 +77,8 @@ public function provides()
return [];
}

protected function isLumen()
{
return str_contains($this->app->version(), 'Lumen');
}
}

0 comments on commit 86b9c71

Please sign in to comment.