hi i'm getting this setup and i want to add a new menu element but only show it to certain people? i can add elements to the array in menu.php so they show up, but i wanted to do something like
if(auth()->id == 123){
"special hidden menu item"
}
but this fails because auth is not available and shows this error:
Illuminate \ Contracts \ Container \ BindingResolutionException
Target class [auth] does not exist.
any advice please?
Really fun to know this. The tools used for the program need to be precise. Learn more experiences while building geometry dash lite on the programming language.
To dynamically show or hide menu elements in a web page, you can use JavaScript (or a library like jQuery) combined with CSS.
No problem. Glad it helps you.
Thanks
great that looks exactly right thank you!
Hi
In Laravel, we have implemented the menu permission using spatie/laravel-permission plugin.
You can check the menu filter code here.app/Core/Adapters/Menu.php
Add permission
or role
in the menu config. For example;
array(
"title" => "Overview",
"path" => "documentation/getting-started/overview",
"role" => ["admin"],
),
$role = Role::create(["name" => "admin"]);
auth()->user->assignRole("admin");