I use DB::connection
to access another database I got right result
$query = 'select organisation from organisations where id = '.$datum->organisation_id . ' LIMIT 1';
$organisation = DB::connection('mysql2')->select($query);
and here is the result:
array:1 [▼
0 => {#2318 ▼
+"organisation": "XYZ Bank"
}
]
I don't know how to access the value of the organisation
.
you can access using
$organisation[0]->organisation
but instead of queries like that you can use Laravel query builder
$organisation = DB::connection('mysql2')->table('organisations')->where('id',$datum->organisation_id)->select('organisation')->first();