Skip to content
Advertisement

How to use nested foreach loop in laravel for populating submenus?

I need to populate the menubar submenus using Laravel. Menus are populating but submenus are not working.

This is my blade file.

JavaScript

This is my controller.

HomeController

JavaScript

This is my category model.

JavaScript

Can anyone please guide me to sort out this?

Advertisement

Answer

try this 1st get all ParentCatrgory then on loop u can call single ParentCatrgory childs

HomeController

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement