thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.72k stars 2.67k forks source link

@can feature on menu items based on permissions #5847

Open Jhamende opened 3 months ago

Jhamende commented 3 months ago

Laravel version

9.52.16

PHP version

8.1.27

Voyager version

1.7

Description of problem

I made a custom menu through menu builder with dynamic routes to the BREAD's. In my view I am looking for a way to only show items current logged in user is allowed to browse.

Proposed solution

having the @can funtion to be able to add routes like @can('browse', $menuitem->route); or @if(Auth::user()->can('browse' . $menu_item->parameters->name)) in every view

Alternatives considered

No response

Additional context

No response