How to display menu like this screenshot?

I stored categories data in tree structure in db. How to get main categories and child categories so on. Anyone could help me.

Thank you.

Assuming your database is stored with a parent_id field, you can use find('threaded') (https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#finding-threaded-data).

Thanks for your reply.