Skip to content

Commit

Permalink
Add Lumen compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Rault committed May 15, 2017
1 parent dd65370 commit 96670e0
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/DB2ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Cooperl\Database\DB2\Connectors\IBMConnector;
use Cooperl\Database\DB2\Connectors\ODBCZOSConnector;
use Illuminate\Support\ServiceProvider;
use Config;

/**
* Class DB2ServiceProvider
Expand Down Expand Up @@ -39,18 +38,13 @@ public function boot()
public function register()
{
// get the configs
$conns = is_array(Config::get('laravel-db2::database.connections'))
? Config::get('laravel-db2::database.connections')
: [];
$conns = is_array(config('laravel-db2::database.connections')) ? config('laravel-db2::database.connections') : [];

// Add my database configurations to the default set of configurations
$this->app['config']['database.connections'] = array_merge(
$conns,
$this->app['config']['database.connections']
);
config(['database.connections' => array_merge($conns, config('database.connections'))]);

// Extend the connections with pdo_odbc and pdo_ibm drivers
foreach (Config::get('database.connections') as $conn => $config) {
foreach (config('database.connections') as $conn => $config) {
// Only use configurations that feature a "odbc", "ibm" or "odbczos" driver
if (!isset($config['driver']) || !in_array($config['driver'], ['odbc', 'ibm', 'odbczos'])) {
continue;
Expand Down

0 comments on commit 96670e0

Please sign in to comment.