outl1ne / nova-settings

A Laravel Nova tool for editing custom settings using native Nova fields.
MIT License
273 stars 97 forks source link

Validation rules on localised settings do not seem to work #82

Open harmenjanssen opened 2 years ago

harmenjanssen commented 2 years ago

I'm trying to make settings required only in certain languages. Following the documentation of nova-translatable, I've implemented this as follows:

Text::make('Street address', 'address_street')
                    ->translatable()
                    ->nullable()
                    ->rulesFor('en', ['required']),

However, this does not make the (English) field required. I noticed in the docs that usually you have to add the HandlesTranslatable trait to the resource, but since I'm registering these fields in the NovaServiceProvider, that doesn't seem appropriate.

Can you tell me how to fix this?

Tarpsvo commented 2 years ago

Hmmmm, that's a very good point - I don't think I ever tested for that usecase. It currently isn't supported, but I will try to think of a solution.