vendredi 2 février 2018

Laravel Many To Many Pivot Table different Database

Laravel 5.5

I've got two models, User and Conversation

User to Conversations is a many to many relationship (both ways).

My table structure is as follows:

conversation is on database_1
conversation_user is on database_1
user is on database_2

All of this is on the same server but is there a way to have this working or not ?

When querying the relationship on Conversation to get users, it's looking for database_2.conversation_user instead of database_1.conversation_user

So in essence, I need to say that the Pivot table is located in database_1, is there a way to do this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire