首先在databa
class User extends Model
{
// 表名
protected $table = 'user';
public function __construct($data = [])
{
$this->connection = [
// 数据库类型
'type' => 'mysql',
// 服务器地址
'hostname' => 'xxx.xxx.xxx.xxx',
'hostport' => 3306,
// 数据库名
'databa
// 数据库用户名
'username' => 'xxx',
// 数据库密码
'password' => 'xxx',
// 数据库编码默认采用utf8
'charset' => 'utf8',
// 数据库表前缀
'prefix' => '',
];
parent::__construct($data);
}
}
然后使用模块的验证功能,设置为
protected $rule = [
'username'=>'require|unique:user'
];
在验证的时候报错了,'db01.aaa_user' doesn't exist
M1模块已经设置了数据库DB02和表user,但在验证时却是去找databa
最佳答案
