laravel-menus icon indicating copy to clipboard operation
laravel-menus copied to clipboard

$menuitem->hideWhen : determining whether menu item is hidden should be based on customized global or menu specific logic

Open douglassdavis opened this issue 1 year ago • 0 comments

I'm searching for a practical way to use the $menuitem->hideWhen property

  1. Each menu item to be shown or hidden does not appear to be passed to the hideWhen function in order for the function to determine whether the menu item should be displayed, making it less useful.
  2. The logic for whether a menuitem is seen or not seen is probably -not- going to be different for each menu item. More than likely, it will be the same for all menus on the site, or at the maximum different for each menu. Having to set one property per menu item seems impractical.

There should be some way of having a global or maybe menu specific function to hide or show menu items. I could then, for example, base it on route permissions.

This would also be a more simple way to solve the problem of a developer wanting to show/hide menus based on spatie/laravel-permissions, mentioned here: https://github.com/nWidart/laravel-menus/issues/58

I'll see what I can do to change this. Or, I might be missing something. Please let me know or post a link to a good example.

douglassdavis avatar Sep 05 '23 19:09 douglassdavis