how use relationship with model different connection #3661
-
suppose I have 2 databases.
in User Model HasOne and in UserGame Model BelongsTo in UserGame model i add
i am trying to get data via user model. but i have error
he should read usergame.userinfo but is still read connection User Model that is apigame if i get data only from UserGame model it works, but if getting data from User Model and preload UserGame doesn't work, it still reads the first database which is mysql |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey @septasite! 👋🏻 You cannot make relationships work across multiple connections. |
Beta Was this translation helpful? Give feedback.
-
this is impossible in adonis js but however in laravel is achieveable using with or eager loading thats the caveat in adonis js |
Beta Was this translation helpful? Give feedback.
Hey @septasite! 👋🏻
You cannot make relationships work across multiple connections.