You can do deeply nested eager loading with:
Serie::with('categories.processes.cards.groups')->get();
This already loads all processes per category, cards per process, etc.
Look at the documentation
$books = Book::with('author.contacts')->get();
If you want a quick way to get all groups, try:
$series = Serie::with('categories.processes.cards.groups')->get()->toArray();
$groups = array_pluck($series, 'categories.processes.cards.groups');
This returns the attributes for every group in array format. You only need to find a new way to perform the ->upload()
method on the group object.