lavary/laravel-menu

README suggests creating menus in middleware but this can lead to performance issues

Opened this issue · 0 comments

If your menu is created dynamically (for instance from database queries) those queries will be executed for every web request, even on pages where you dont have menus. This is because Menu::makeOnce resolves callback immediately! I was not aware of that and honestly this behaviour surprised me. I think callback should be resolved while trying to render menu.