Replies: 4 comments
-
You need to share some code of what you are tried so far |
Beta Was this translation helpful? Give feedback.
-
Yeah sorry, it's because it was more in the idea process than already done but hurthing process :) For example I have this Country model
In my controller, before the children / parent needs I was retrieving countries posts like so But now, I would like to retrieve for a parent, all the country children posts as well. |
Beta Was this translation helpful? Give feedback.
-
Or maybe, I do this in the wrong way ? |
Beta Was this translation helpful? Give feedback.
-
If I do this
I will get my countries and their posts, and also their children with own data. But what I would like to achieve (if possible) is to have a way to retrieve all the posts() from the direct relation and the children relation. (self) Like a allPosts method in the model who will concat the direct post and the post from the self-relation. Is it possible ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey community :)
I have a question about data retrieval with self relationship.
My need / my model is the following.
I have a parent (people) who has children (people also), with a parent_id referencing the same table.
And these people can take picture,
So the people have a relationship to retrieve these pictures.
But my need to is to retrieve all the pictures for him and also all his children.
How can I achieve that (without raw querying ^^') ?
Thanks guys for your help :)
Beta Was this translation helpful? Give feedback.
All reactions