In relationship query, a tablename.id field was added into the query string automatically, how I can forbid it? #1085
Unanswered
smartbox-jiandonghan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the relationship, user table is the parent table, post table is the child table.
in post table, the primarykey is not 'id' or 'post_id'. it's 'post_number' + another field, a composite primary key.
I have declared the relationship in model user and model post with 'hasMany' and 'belongsTo'.
in the user query resolve method, I have the following code.
''''''
''''''
then in the query result. I got an error: "post.id: invalid identifier . select ..... post.id from ......."
My issue is: why the post.id was added to the query string. It may because of some eloquent's by default operations? how I can forbid it?
Can we have other alternative solutions to use the relationship query?
Great thanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions