Skip to content

Commit

Permalink
add dbgroup option to CI4 Adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
n1crack committed Jun 11, 2024
1 parent 99218da commit a7449ff
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 a7449ff

Please sign in to comment.