Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent
Last updated 2 years 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 2 years ago.
0

Sign in to participate in this thread!

Eventy

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?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.