Note that using the Vmconfig::on('connectionName') works. I am complicating things by taking the database connection name dynamically, but is there a way to use that with Eloquent relationships?
Note the following inline comments
public function vmdetail($vcenter, $vm)
{
$vmData = Vm::on($vcenter)->where('NAME', $vm)->first()->vmconfig;
var_dump($vmData);
#this returns the correct ID '2556'
var_dump($vmData->vmconfig);
#this returns null. is there a 'on' or 'connection' parameter that is needed here?
$vmConfig = Vmconfig::on($vcenter)->find($vmData->VMID);
var_dump($vmConfig);
#this returns the correct data
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community