Might be the language barrier as I am not a native English speaker so apologize me if I didn't get what you mean.
As you want to perform an operation after the children are loaded (makeHidden) I don't see a way to do it in a single step. But, in my opinion the following approach seems clearer:
$parents = Parent::query()
->with([
'children' => function ($relation) {
$relation->setEagerLoads([])
// some children's Eloquent related conditions
// don't use get() here, as this closure will be run when eager loading children
;
},
])
// some parent's Eloquent related conditions
->get();
$parents->each(function (Parent $parent) {
$parent->children->each->makeHidden([
'someAppendedAttribute',
]);
});
This seems clearer for me because you group the fetching (before DB retrieval) logic and the processing (after DB retrieval) into two blocks of code.
Also as the parent's childrens are eager loaded you don't need to manually associate a parent to its children.