-
Notifications
You must be signed in to change notification settings - Fork 11.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refresh(): Call to undefined relationship [pivot] on model #31811
Comments
This feels kinda hacky. Shouldn't we have an interface for this? |
Agreed, but interface will not fix existing code |
I'd prefer to use the interface in all honesty, and I'm sure if people run into this problem they will find the information in the docs somewhere. I don't believe traits should be used to enforce outside functionality on the edge of your application. The interface approach has already been taken with other checks & rules for model classes. Happy to make a PR with the new marker interface. |
Why aren't you extending the |
@driesvints for the same reasons as described in initial PR #25851 ("own abstract Model class") |
I see. Then an interface won't work here because people would have to implement it manually to solve the problem. We could maybe go for the solution you proposed above. Feel free to send in a PR. |
Description:
This is a regression introduced in #31125 - all custom pivot models that uses
AsPivot
trait are broken now due to this line:framework/src/Illuminate/Database/Eloquent/Model.php
Line 1154 in 898f24e
obviously it should also check if the model uses
AsPivot
trait. Something like:Steps To Reproduce:
user_users
tableThe text was updated successfully, but these errors were encountered: