Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
675 views
in Technique[技术] by (71.8m points)

laravel - How to hide a whole menu with its submenu if you do not have the permission? Spatie-Menu

I created a sub menu that hides the options of the submenu if I do not have the permission, but it leaves me the name of the menu, I do not know if you understand. I attach images.

User with permission has access to see the Management Report menu. ??

enter image description here

User without permission should NOT have access to see the Management Report menu.

enter image description here

This is the code

->submenu(
    SpatieMenuLink::to('#','<i class="ri-folder-chart-line"></i><span>Reportes Gerenciales</span><i
        class="ri-arrow-right-s-line iq-arrow-right"></i>')
        ->addClass('iq-waves-effect'),
    Menu::new()
        ->addClass('iq-submenu')
        ->routeIfCan('view all reports', 'home.salesManager', 'Desempe?o de leads')
        ->routeIfCan('view all reports', 'home.historicalReports', 'Historico de ejecutivo')
)
question from:https://stackoverflow.com/questions/65847718/how-to-hide-a-whole-menu-with-its-submenu-if-you-do-not-have-the-permission-spa

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...