Subpages in Subpages with foreach loop

Hello everybody,

I’m working on a project for a restaurant. The owner wants to edit his menu via kirby. So I created a css file which makes the HTML look like the menu he gives out in his restaurant.
I created a page which has the subpages for the categories like soup or salat, in this subpages are again subpages with the meals and the prices. So far so good, now on to the problem:

I created a foreach loop to show all categories and in this loop another loop to show the meals. But here must be my mistake, every category has all meals in it. Do you guys no how to handle this problem? I’m completely stuck here.

Thanks in advance!

Ok, after thinking again what I did, I came up with this solution.
I would like to show it to you, maybe somebody else has the same problem:

It looks like you are looping on all the grandchildren when you print every categorie,

you need to change the inner foreach to only happen on the categorie something like (untested)

$kategorie->children() as $speise