Support the ongoing development of Laravel.io →
posted 8 years ago
Eloquent
Last updated 4 months ago.
0

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

Last updated 4 months ago.
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

danjellz danjellz Joined 15 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.