Why are BelongsTo relationships based off the method name, and not the model name? #52728
Unanswered
SebastianSlangerup
asked this question in
Q&A
Replies: 2 comments 2 replies
-
You are perfectly right. I never let laravel guess the parameters of the relation definition and I did not saw this before. Good catch. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I asked the same question about a year ago and got no more feedback than you have here. This remains one of the bizarrest design choices in Laravel to me. Completely unintuitive, breaks consistency, has zero practical benefits (as far as I can see)… just all-around weird. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
The documentation reads:
But I was curious and I'd like to know more about the technical side of this, if there are any...
Why the method name? Wouldn't it make more sense to base this relationship off of the model passed into the method instead?
Beta Was this translation helpful? Give feedback.
All reactions