Replies: 2 comments 2 replies
-
You must select also the column that links the User to the relation. Update. This is in L 10 and L9 Your situation is this
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Sure, I don't understand the demo page but now I understand that I need to include the relationship column, thanks <3 |
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
-
In my learning path I understood that I should bring only the columns that I am going to use and not all the columns and this would allow me to have fast and efficient queries, but when trying to do a select and at the same time bring data from a relation it responds with the null relation:
example:
$users = User::select('id','name')->with('post')->get();
or$users = User::select(['id','name'])->with('post')->get();
it doesn't work for me, I use
dd($users)
and I verify that in relations I get nullif I remove "select" it correctly brings the relation data, am I doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions