Laravel, Nova

Laravel Nova: Control Sidebar Display

Assalamualaikum / Hi,I have come with a requirement, where users can do CRUD operation for Nova resources, but want to control the sidebar display based on user’s permission / role / policy.

To enable that, you need to overwrite the availableForNavigation static method, as following.

As you can see, what I did basically to check if there is static permission property, I will use that to check with Spatie permission.

You may apply your own logic to control the sidebar display.

Hopes that help you in more flexible way to control your sidebar.

Thanks,
Nasrul Hazim

Leave a Reply

Your email address will not be published. Required fields are marked *

2 × 4 =