Closed lvdhoorn closed 5 years ago
@orlyapps just discovered this one myself, kind of a deal breaker... any chance we can patch this up?
@lvdhoorn I think this was actually a bug with Nova. The latest release, 1.1.7, added in support for nullable() BelongsTo fields. This is working for me:
NovaBelongsToDepend::make('Consumer', 'client', \App\Nova\Client::class)
->optionsResolve(function ($user) {
return $user->clients;
})
->dependsOn('User')
->onlyOnForms()
->nullable()
@lvdhoorn thanks. I will close this issue then.
As far as i can see it is not possible to make a field not required.
For example we have the following fields:
NovaBelongsToDepend::make('Week') ->options(\App\Week::where('year', '=', date('Y'))->get()), NovaBelongsToDepend::make('Country', 'Country', '\App\Nova\Country') ->optionsResolve(function ($week) { return $week->countries()->get(); }) ->dependsOn('Week')
A week field is a required field for us but a country field is not.
It would be really great if we can make a depended field optional.