runlinenl / nova-profile-tool

This package adds a tool for Laravel nova to let a user manage their profile data
MIT License
37 stars 40 forks source link

Configurable fields #2

Open neamtua opened 6 years ago

neamtua commented 6 years ago

Hi, it would be great if you could make the fields configurable. For instance I don't use the base model with name and I use first_name and last_name fields and I need to change that.

patrickbergman commented 6 years ago

Hi,

Thank you so much for the suggestion. This is something I'd like to do as well. Only the way to do it is still something I need te figure out, how the form fields are build etc.

If you know a good solution, it would be more then welcome :)

neamtua commented 6 years ago

Perhaps the best way to do it would be to make a config file and define the Nova resource file to read the fields() function content and in the same config to define an array of field names that you do not wish to allow editing. I'm not sure if this is the best approach because I haven't read too much into the nova source code but if you can easily render the fields the same way nova does and take into account the rules and everything defined in the resource then it would be awesome.

nasrulhazim commented 5 years ago

it's good to have simple configuration.

for instance, I don't want the user to update their email address.

wemersonrv commented 5 years ago

@neamtua i agree with you, if profile can reflect the entire model it would be amazing.

But, in some cases there are some fields we don't want to change, in my specific case users can login using both email and CPF fields. CPF is an brazilian document number similar and it's unique for person. So i don't need to add it to allow users to change these two files.

And the password, i believe @patrickbergman gives the solution: Do not update password when its empty.

And of course, other files like birthdate, nickname, address; etc. it would be nice to be in the profile too!

So a configuration file detailing the fields to be updated would be interesting.