orlyapps / nova-belongsto-depend

Larave Nova BelongsTo Field with Dependcy
MIT License
182 stars 65 forks source link

Nova-belongsto-depend not working inside Nova Field Dependency Container #43

Open lvdhoorn opened 5 years ago

lvdhoorn commented 5 years ago

When i use Nova-belongsto-depend inside Nova Field Dependency Container the fields depended fields no longer gets filled.

The code that i am using:

Select::make('invoicing', 'invoicing')->options([
                            'yes' => 'yes',
                            'no' => 'no',
                        ])
                        ->displayUsingLabels()
                        ->withMeta(['value' => (function(){
                            return $this->profitDebtorCompany ? 'yes' : 'no';
                        })()])
                        ->fillUsing(function(){}),

                    NovaDependencyContainer::make([
                        NovaBelongsToDepend::make('company', 'company', 'App\Nova\Company')
                            ->options(Company::all())
                            ->fillUsing(function(){}),

                        NovaBelongsToDepend::make('debtor', 'debtor', 'App\Nova\Debtor')->optionsResolve(function ($company) {
                            return $company->debtors()->get(['id', 'company_name', 'debtor_code']);
                        })->dependsOn('company'),

                        NovaBelongsToDepend::make('product', 'product', 'App\Nova\Product')->optionsResolve(function ($company) {
                            return $company->products()->get(['id', 'product_name', 'product_code']);
                        })->dependsOn('debtor')->hideFromIndex(),
                    ])->dependsOn('invoicing', 'yes'),

Outside the container everthing is working fine.

nyssLab commented 5 years ago

I'm still facing this issue what is the state on the fix ?