Files
hdk-admin/src/Install/InstallCommand.php
李东云 55bd2fab90 feat: 初始化hyperf-admin项目,添加基础模型、服务和控制器
本次提交初始化了hyperf-admin项目,主要包括以下内容:
- 添加了基础模型如User、Role、Menu等
- 实现了权限、日志、配置等核心服务
- 添加了系统管理、用户管理、日志管理等控制器
- 配置了路由和中间件
- 添加了.gitignore和README.md文件
2025-04-16 15:34:40 +08:00

30 lines
755 B
PHP

<?php
namespace HyperfAdmin\Admin\Install;
use Hyperf\Command\Command as HyperfCommand;
use Hyperf\DbConnection\Db;
class InstallCommand extends HyperfCommand
{
protected $name = 'hyperf-admin:admin-install';
protected function configure()
{
$this->setDescription('install db from hyperf-admin.');
}
public function handle()
{
$db_conf = config('databases.hyperf_admin');
if (!$db_conf || !$db_conf['host']) {
$this->output->error('place set hyperf_admin db config in env');
}
$sql = file_get_contents(__DIR__ . '/install.sql');
$re = Db::connection('hyperf_admin')->getPdo()->exec($sql);
$this->output->success('hyperf-admin db install success');
}
}