Using 'legacy_db' as an example of the actual name for your old database, would this work?
class Topic extends Eloquent
{
protected $primaryKey = 'token';
public function members()
{
$relation = $this->belongsToMany('Member');
$relation->table = 'legacy_db.legacy_members_table';
return $relation;
}
}
Take a look at this to clarify http://fideloper.com/laravel-multiple-database-connections
OK, I figured it out (after some sleep). Thanks @thevelement to point me into the right direction.
Simply specify [database].[table_name] as the second argument of the relation
class Topic extends Eloquent
{
protected $primaryKey = 'token';
public function members()
{
retrun $this->belongsToMany('Member','legacy_db.legacy_members_table');
}
}
Was this really resolved? Are you truly using two distinct servers or just two different schemas?
I am still unable to do this across two server connections (vs two schemas).
You can do it across multiple server connections with Eloquent. It can get tricky when trying to query through Fluent.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community