Replies: 1 comment 2 replies
-
Hi, I have just experienced similar issue where Eloquent model without pre-defined connection where it tries to use one from the parent. I think it's completely wrong. It would be awesome if you could create a PR to this. Thanks. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When working together with legacy i found weird issue (or more like edge case?)
Using $model->fresh(['relation']) when relation uses different connection assumes that relation has same connection as $model, unless declared otherwise.
Even if relation uses default db, $model with non-default connection will freak out when using ->fresh(), since it will try to use its custom connection specified in model.
Probably having model boot its $connection with config('database.default') would solve it, but i have no idea on how much of a strain on performance that will add. I've tested changing stuff locally and found that updating model class to have
but i'm too dumb to commint my own PR to something as big as laravel, so i decided to discuss this here first
Here's how to replicate
Beta Was this translation helpful? Give feedback.
All reactions