Fix support Lumen
This commit is contained in:
parent
b0738b17a2
commit
32be149f95
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Cooperl\Database\DB2;
|
namespace Cooperl\Database\DB2;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Application as LaravelApplication;
|
||||||
|
use Laravel\Lumen\Application as LumenApplication;
|
||||||
use Cooperl\Database\DB2\Connectors\ODBCConnector;
|
use Cooperl\Database\DB2\Connectors\ODBCConnector;
|
||||||
use Cooperl\Database\DB2\Connectors\IBMConnector;
|
use Cooperl\Database\DB2\Connectors\IBMConnector;
|
||||||
use Cooperl\Database\DB2\Connectors\ODBCZOSConnector;
|
use Cooperl\Database\DB2\Connectors\ODBCZOSConnector;
|
||||||
@ -28,9 +30,8 @@ class DB2ServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$this->publishes([
|
$configPath = __DIR__ . '/config/db2.php';
|
||||||
__DIR__ . '/config/config.php' => config_path('db2.php'),
|
$this->publishes([$configPath => $this->getConfigPath()], 'config');
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,6 +86,20 @@ class DB2ServiceProvider extends ServiceProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the config path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getConfigPath()
|
||||||
|
{
|
||||||
|
if ($this->app instanceof LaravelApplication) {
|
||||||
|
return config_path('db2.php');
|
||||||
|
} elseif ($this->app instanceof LumenApplication) {
|
||||||
|
return base_path('config/db2.php');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the services provided by the provider.
|
* Get the services provided by the provider.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user