讨论数量:
在 database.php
配置好多个数据库的信息之后
使用时可以用 connection
方法连接不同的库
DB:
DB::connection('db1')->table('users')->get();
DB::connection('db2')->table('users')->get();
ORM:
class User extends Model
{
protected $connection = 'db1';
}
推荐文章: