Skip to content

Commit

Permalink
Merge pull request #108 from n1crack/dev
Browse files Browse the repository at this point in the history
add dbgroup option to CI4 Adapter
  • Loading branch information
n1crack authored Jun 11, 2024
2 parents 7da8e24 + a7449ff commit 8c83cce
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/DB/Codeigniter4Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,22 @@ class Codeigniter4Adapter extends DBAdapter
protected $db;

/**
* @var $config
* @var array
*/
protected $config;

public function __construct($config = null)
{

$this->config = $config ?? ['DBGroup' => 'default'];
$this->config['DBGroup'] = $this->config['DBGroup'] ?? 'default';
}

/**
* @return $this
*/
public function connect()
{
$this->db = \Config\Database::connect();
$this->db = \Config\Database::connect($this->config['DBGroup']);

return $this;
}
Expand Down

0 comments on commit 8c83cce

Please sign in to comment.