类 IlluminateDatabaseQueryBuilder 的对象无法转换为字符串,无法在单个查询中从


class Report extends Eloquent {
protected $connection1 = 'mysql1';
    protected $table1 = 'table1';
protected $connection2 = 'mysql2';
    protected $table2 = 'table2';
public function getdetails() {
$mysql1_conn = DB::connection('mysql1');
$mysql2_conn = DB::connection('mysql2');
$result = $mysql1_conn->table('table1 as t1')
          ->{$mysql2_conn->table('table2 as t2')}
         ->ON('t1.userid' , '=' , 't2.userid')
         ->select('t1.id','t2.name','t1.number','t2.address')
         ->get();
        return $result;
}
}

我收到错误

" 类 Illuminate\Database\Query\Builder 的对象无法转换为字符串">

不能使用两个数据库连接运行单个查询。

相关内容

  • 没有找到相关文章

最新更新