Laravel sql server 更改模式的表名

Nel*_*dia 1 database sql-server eloquent laravel-5 laravel-eloquent

我正在处理一个项目,我试图在我的 SQL Server 数据库上设置一些带有架构的表,所以我手动将表名称更改为迁移文件上的 schema_name.table_name 并且它起作用了,所以这里是一个例子:

Schema::create('electoral.centro_votacions', function (Blueprint $table) {
        $table->bigInteger('id_estado');

        $table->bigInteger('id_municipio');

        $table->bigInteger('id_parroquia');

        $table->bigInteger('id');

        $table->string('nombre');

        $table->longText('direccion');

        $table->foreign(['id_parroquia','id_municipio','id_estado'])->references(['id','id_municipio','id_estado'])->on('electoral.parroquias');
        $table->primary('id');
});
Run Code Online (Sandbox Code Playgroud)

但是,当我试图对 php 进行雄辩的查询时,php artisan tinker它不起作用,我只是收到一条错误消息,例如进行查询App\CentroVotacion::all();

Illuminate\Database\QueryException 带有消息“SQLSTATE[42S02]:[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]无效的对象名称“centro_votacions”。(SQL: select * from [centro_votacions])'

当然我知道没有表“centro_votacions”有一个表叫“electoral.centro_votacions”,所以问题是我怎样才能让laravel改变查询,以便我可以找到“electoral.centro_votacions”表和其他我的 SQL Server DB 上的架构?。

Ana*_*mov 5

内部CentroVotacion模型定义表名

class CentroVotacion extends Model
{
    protected $table = 'electoral.centro_votacions';
Run Code Online (Sandbox Code Playgroud)