10-24-2018, 07:15 AM
A thought for Model - read/write connections:
Maybe the Model $DBGroup property could accept an array as:
And a new method like getConnection($type) to return the $db.
The builder() method could have a second param $type.
Then run the SELECTs, UPDATEs, etc according with the connection type.
Maybe the Model $DBGroup property could accept an array as:
PHP Code:
protected $DBGroup = [
'read' => 'slave',
'write' => 'master'
];
And a new method like getConnection($type) to return the $db.
The builder() method could have a second param $type.
Then run the SELECTs, UPDATEs, etc according with the connection type.