Fix support Lumen
This commit is contained in:
parent
b0738b17a2
commit
32be149f95
@ -1,36 +1,36 @@
|
|||||||
{
|
{
|
||||||
"name": "cooperl/laravel-db2",
|
"name": "cooperl/laravel-db2",
|
||||||
"description": "laravel-db2 is a simple DB2 service provider for Laravel. It provides DB2 Connection by extending the Illuminate Database component of the laravel framework.",
|
"description": "laravel-db2 is a simple DB2 service provider for Laravel. It provides DB2 Connection by extending the Illuminate Database component of the laravel framework.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"laravel",
|
"laravel",
|
||||||
"DB2",
|
"DB2",
|
||||||
"Database",
|
"Database",
|
||||||
"PDO",
|
"PDO",
|
||||||
"ODBC"
|
"ODBC"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Maxime Rault",
|
"name": "Maxime Rault",
|
||||||
"role": "Developer"
|
"role": "Developer"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1.3",
|
"php": ">=7.1.3",
|
||||||
"illuminate/database": "5.7.*"
|
"illuminate/database": "5.7.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Cooperl\\Database\\DB2\\": "src/"
|
"Cooperl\\Database\\DB2\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
"providers": [
|
||||||
"Cooperl\\Database\\DB2\\DB2ServiceProvider"
|
"Cooperl\\Database\\DB2\\DB2ServiceProvider"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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