I have two models, FirstModel
and SecondModel
.
FirstModel has the default database connection of mysql
and SecondModel
is on anotherMysql
connection. So far, so good: say I try to do a one-to-many relationship, it works pretty well. But I need a many-to-many relationship, which is totally standard, but.
The pivot table firstModel_secondModel
exists on the mysql
connection (same as FirstModel
).
Trying to query the many-to-many relationship like so: $firstModel->secondModels
will result in an error, since is seeking the pivot table on the SecondModel
's connection.
So my question is... Can I tell eloquent to seek the pivot table elsewhere? Is there a way to specify the pivot's connection ?