jeroennoten / Laravel-AdminLTE

Easy AdminLTE integration with Laravel
MIT License
3.78k stars 1.08k forks source link

Improve Gate Filter / Fix Issue #1111 #1259

Closed dfsmania closed 3 months ago

dfsmania commented 4 months ago
Question Answer
Issue or Enhancement Issue
License MIT

What's in this PR?

Improve the Gate filter to also restrict submenu items were all its children are also restricted.

Fix #1111

Checklist

dfsmania commented 4 months ago

[!Caution] Review this logic, will this also work for nested submenu items?

dfsmania commented 4 months ago

Added test to check the logic on nested submenus. The logic actually work because deeper submenues are filtered/transformed first.

dfsmania commented 4 months ago

@ruanpepe After inspecting the logic for menu creation, I decided to move the logic to filter an empty submenu to an upper level section, it's cleaner now and less tricky than adding it on the Gate Filter.

I have created tests to cover the cases, but it would help more if you can test these changes in your environment too, it's just a minor change on the MenuItemHelper class.

Regards!