Eloquent determines the foreign key of the relationship based on the model name.
but in the HasRelationship class in the belongsTo method, I can see this comment
If no foreign key was supplied, we can use a backtrace to guess the proper foreign key name by using the name of the relationship function, which when combined with an "_id" should conventionally match the columns.
So.. the documentation is wrong?
I've tested it and is true..so how it works exactly? (I already know how to set it manually)
How Eloquent determines the foreign key of the relationship?
The documentation says:
but in the HasRelationship class in the belongsTo method, I can see this comment
So.. the documentation is wrong?
I've tested it and is true..so how it works exactly? (I already know how to set it manually)
Thanks.