Skip to content

[v5] BelongsTo, preloading and associate() question #2224

Answered by thetutlage
42pe asked this question in Help
Discussion options

You must be logged in to vote

Yes, the model needs the foreignKeys to be available on the model itself. Infact, the foreignKey property inside relationship options is the name of the property on the model and not the table.

To summarize it, Models form relationships with each other and not the database tables.

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@42pe
Comment options

Answer selected by 42pe
Comment options

You must be logged in to vote
1 reply
@thetutlage
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants