用hyper gen:model命令,为指定数据库生成表文件,
—pool string default 连接池,脚本会根据当前连接池配置创建
php bin/hyperf.php gen:model sysconfig --pool extradb
<?php
declare(strict_types=1);
use Hyperf\Database\Commands\ModelOption;
return [
'extradb' => [
// 忽略其他配置
'commands' => [
'gen:model' => [
'path' => 'app/Model',
'force_casts' => true,
'inheritance' => 'Model',
'uses' => '',
'refresh_fillable' => true,
'table_mapping' => [],
'with_comments' => true,
'property_case' => ModelOption::PROPERTY_SNAKE_CASE,
],
],
],
];
参考:https://www.likecs.com/show-307324608.html?sc=1893