Closed Sitethief closed 3 years ago
@Sitethief you can use authorization for tool
like this (app/Providers/NovaServiceProvider.php
)
public function tools(): array
{
return [
NovaSettings::make()->canSee( fn() => is_user_can_settings() ),
];
}
Hi @Sitethief!
I added support for per-field authorization in version 3.1.0. If you want to hide the whole thing from the sidebar, I think @medvinator provided a pretty good solution.
I also added it to the README: https://github.com/optimistdigital/nova-settings#authorization
Thanks and good luck guys!
Yes, that works! Thanks!
I could not get a Policy working on the
Settings
model. I tried the automatic way just by making aSettingsPolicy
, and also tried registering the policy in theAuthServiceProvider
. I quick fixed it with a temporary solution by wrapping the fields inNovaServiceProvider
in an if statement dependent on the user permissions, but this still has the drawback of the settings page still being visible, albeit empty.Am I missing something, or is this simply not implemented? or is there maybe a way to do this that I haven't found yet?