ampersand
203
3
Nova

Set default value on hidden fields

Posted 1 month ago by ampersand

Hi,

I found this interesting section on the Laravel Nova's Documentation page: https://nova.laravel.com/docs/2.0/resources/authorization.html#fields

I want to hide some fields based on a user role (defined using policies), but I'd like to set a default value when this is the case. I try to explain what I'm trying to achieve a little better:

An admin should be able to assign a client to a user via a relationship field on the user model, so admins should be able to see a field on the user creation and update pages to select which client the user belongs to. Regular users can invite (and create) other users, but when they do, the new users should be assigned to the same client, the user creating the new user belongs to.

Any idea about how I could solve this using Nova?

Thanks for the help :)

Please sign in or create an account to participate in this conversation.