Skip to content

Commit

Permalink
revert extend code
Browse files Browse the repository at this point in the history
  • Loading branch information
jfelder committed Jul 25, 2024
1 parent 82f76e0 commit 6d9be93
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Jfelder/OracleDB/OracleDBServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,21 @@ public function register()
// merge default config
$this->mergeConfigFrom(__DIR__.'/../../config/oracledb.php', 'database.connections');

// override any default configs with user config
// load default configs
$config = [
"oracle" => config('database.connections.oracle')
];

// override any default configs with user config and load those configs
if (file_exists(config_path('oracledb.php'))) {
$this->mergeConfigFrom(config_path('oracledb.php'), 'database.connections');

$config = $this->app['config']->get('oracledb');
}

// get only oracle configs to loop thru and extend DB
$config = $this->app['config']->get('oracledb', []);

$connection_keys = array_keys($config);

// loop thru oracle configs to extend DB
if (is_array($connection_keys)) {
foreach ($connection_keys as $key) {
$this->app['db']->extend($key, function ($config) {
Expand Down

0 comments on commit 6d9be93

Please sign in to comment.