Skip to content

Commit 32be149

Browse files
committed
Fix support Lumen
1 parent b0738b1 commit 32be149

File tree

3 files changed

+47
-32
lines changed

3 files changed

+47
-32
lines changed

composer.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
{
2-
"name": "cooperl/laravel-db2",
3-
"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.",
4-
"keywords": [
5-
"laravel",
6-
"DB2",
7-
"Database",
8-
"PDO",
9-
"ODBC"
10-
],
11-
"license": "MIT",
12-
"authors": [
2+
"name": "cooperl/laravel-db2",
3+
"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.",
4+
"keywords": [
5+
"laravel",
6+
"DB2",
7+
"Database",
8+
"PDO",
9+
"ODBC"
10+
],
11+
"license": "MIT",
12+
"authors": [
1313
{
14-
"name": "Maxime Rault",
15-
"role": "Developer"
14+
"name": "Maxime Rault",
15+
"role": "Developer"
1616
}
17-
],
18-
"require": {
19-
"php": ">=7.1.3",
20-
"illuminate/database": "5.7.*"
21-
},
22-
"require-dev": {
23-
},
24-
"autoload": {
17+
],
18+
"require": {
19+
"php": ">=7.1.3",
20+
"illuminate/database": "5.7.*"
21+
},
22+
"require-dev": {
23+
},
24+
"autoload": {
2525
"psr-4": {
26-
"Cooperl\\Database\\DB2\\": "src/"
26+
"Cooperl\\Database\\DB2\\": "src/"
2727
}
28-
},
29-
"extra": {
30-
"laravel": {
31-
"providers": [
32-
"Cooperl\\Database\\DB2\\DB2ServiceProvider"
33-
]
28+
},
29+
"extra": {
30+
"laravel": {
31+
"providers": [
32+
"Cooperl\\Database\\DB2\\DB2ServiceProvider"
33+
]
34+
}
3435
}
35-
}
3636
}

src/DB2ServiceProvider.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Cooperl\Database\DB2;
44

5+
use Illuminate\Foundation\Application as LaravelApplication;
6+
use Laravel\Lumen\Application as LumenApplication;
57
use Cooperl\Database\DB2\Connectors\ODBCConnector;
68
use Cooperl\Database\DB2\Connectors\IBMConnector;
79
use Cooperl\Database\DB2\Connectors\ODBCZOSConnector;
@@ -28,9 +30,8 @@ class DB2ServiceProvider extends ServiceProvider
2830
*/
2931
public function boot()
3032
{
31-
$this->publishes([
32-
__DIR__ . '/config/config.php' => config_path('db2.php'),
33-
]);
33+
$configPath = __DIR__ . '/config/db2.php';
34+
$this->publishes([$configPath => $this->getConfigPath()], 'config');
3435
}
3536

3637
/**
@@ -85,6 +86,20 @@ public function register()
8586
}
8687
}
8788

89+
/**
90+
* Get the config path
91+
*
92+
* @return string
93+
*/
94+
protected function getConfigPath()
95+
{
96+
if ($this->app instanceof LaravelApplication) {
97+
return config_path('db2.php');
98+
} elseif ($this->app instanceof LumenApplication) {
99+
return base_path('config/db2.php');
100+
}
101+
}
102+
88103
/**
89104
* Get the services provided by the provider.
90105
*
File renamed without changes.

0 commit comments

Comments
 (0)