How to get the child entries of current using Statamic\Entries\Entry object?

If I have a parent entry ID and want to get the direct children entries of the current entry. How do I do that?

I have an Statamic\Entries\Entry object from an Statamic\Events\EntrySaved event.

I can get an array of the collection tree, which I can then filter, but this seems a bit convoluted?

info(print_r($event->entry->structure()->in('default')->tree(), true));

The other thing I have considered is to add an Entry field in the blueprint called my_parent or something then use:

Statamic\Fascade\Entry::query() 
    ->where('my_parent', 'e2af94d1-12b1-4934-bf94-b368b227cfce')
    ->first();

But again, this seems ridiculous?

>>>>>>> Unanswered <<<<<<<
2 Replies
2 Followers