因为你可以配置 MySQL 驱动使用一个:
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
您可以为您的特定查询创建不同的连接:
'mysql-collation' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => '<your collation>',
'prefix' => '',
),
并在您的查询中使用该连接:
$users = DB::connection('mysql-collation')->select(...);
编辑:
在模型上,您可能可以通过这种方式设置连接:
$posts = new Word;
$posts->setConnection('mysql-collation');
$posts->where(...);