Skip to content
This repository has been archived by the owner on Feb 7, 2025. It is now read-only.

@can feature on menu items based on permissions #5847

Open
Jhamende opened this issue Mar 14, 2024 · 0 comments
Open

@can feature on menu items based on permissions #5847

Jhamende opened this issue Mar 14, 2024 · 0 comments
Labels

Comments

@Jhamende
Copy link

Jhamende commented Mar 14, 2024

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', $menu_item->route); or @if(Auth::user()->can('browse_' . $menu_item->parameters->name)) in every view

Alternatives considered

No response

Additional context

No response

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant