改名
This commit is contained in:
@@ -26,25 +26,32 @@ class DatabasesProviders extends Component
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
$name = 'databases.' . $name;
|
||||
$config = Config::get('databases.' . $name, true);
|
||||
|
||||
$application = Snowflake::get();
|
||||
if (!$application->has($name)) {
|
||||
$generate = [
|
||||
'class' => Connection::class,
|
||||
'id' => 'db',
|
||||
'cds' => $config['cds'],
|
||||
'username' => $config['username'],
|
||||
'password' => $config['password'],
|
||||
'tablePrefix' => $config['tablePrefix'],
|
||||
'maxNumber' => 100,
|
||||
'slaveConfig' => $config['slaveConfig']
|
||||
];
|
||||
return $application->set($name, $generate);
|
||||
} else {
|
||||
return $application->get($name);
|
||||
if ($application->has('databases.' . $name)) {
|
||||
return $application->get('databases.' . $name);
|
||||
}
|
||||
$config = $this->getConfig($name);
|
||||
return $application->set('databases.' . $name, [
|
||||
'class' => Connection::class,
|
||||
'id' => 'db',
|
||||
'cds' => $config['cds'],
|
||||
'username' => $config['username'],
|
||||
'password' => $config['password'],
|
||||
'tablePrefix' => $config['tablePrefix'],
|
||||
'maxNumber' => 100,
|
||||
'slaveConfig' => $config['slaveConfig']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @return array|mixed|null
|
||||
* @throws ConfigException
|
||||
*/
|
||||
public function getConfig($name)
|
||||
{
|
||||
return Config::get('databases.' . $name, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user