ziffmedia / nova-select-plus

A Laravel Nova Select Field
MIT License
91 stars 26 forks source link

DependsOn: native field options don't work #63

Open Keko-94 opened 12 months ago

Keko-94 commented 12 months ago
          But still some native field options don't work, for example:
SelectPlus::make('Product Varieties', 'productVarieties', ProductVariety::class)
    ->usingDetailLabel('name')
    ->resolveUsing(fn($models) => $models->sortBy('pivot.order')->values())
    ->reorderable('order')
    ->required()
    ->onlyOnForms()
    ->dependsOn('productType', function (SelectPlus $field, NovaRequest $request, FormData $formData) {
        if (!$formData->productType) {
           $field->show();
        } else {
          $field->hide();
       }
    })

I would like to be able to add for example: ->required() or disable it depending on the other field. On all others basic Nova Fields all this methods work as they should.

Originally posted by @Bibesko in https://github.com/ziffmedia/nova-select-plus/issues/49#issuecomment-1523327866