注入Query类

This commit is contained in:
wuyanwen
2020-01-13 16:23:08 +08:00
parent 9e2c84dd54
commit 3b67f3fb5f

View File

@@ -6,6 +6,7 @@ use catchAdmin\permissions\OperateLogListener;
use catchAdmin\permissions\PermissionsMiddleware; use catchAdmin\permissions\PermissionsMiddleware;
use catchAdmin\system\event\LoginLogEvent; use catchAdmin\system\event\LoginLogEvent;
use catchAdmin\system\event\OperateLogEvent; use catchAdmin\system\event\OperateLogEvent;
use catcher\CatchQuery;
use catcher\command\BackupCommand; use catcher\command\BackupCommand;
use catcher\command\CompressPackageCommand; use catcher\command\CompressPackageCommand;
use catcher\command\CreateModuleCommand; use catcher\command\CreateModuleCommand;
@@ -33,6 +34,7 @@ class CatchAdminService extends Service
$this->registerMiddleWares(); $this->registerMiddleWares();
$this->registerEvents(); $this->registerEvents();
$this->registerListeners(); $this->registerListeners();
$this->registerQuery();
} }
/** /**
@@ -116,4 +118,15 @@ class CatchAdminService extends Service
], ],
]); ]);
} }
protected function registerQuery()
{
$connections = $this->app->config->get('database.connections');
$connections['mysql']['query'] = CatchQuery::class;
$this->app->config->set([
'connections' => $connections
], 'database');
}
} }