orlyapps / nova-belongsto-depend

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

Field Not Prepolutating On Edit Screen When Value Is Set #6

Closed David-Melo closed 6 years ago

David-Melo commented 6 years ago

On the index page, preview page and in the database, the field is populated correctly. On the edit page the field appears to be empty and not set.

orlyapps commented 6 years ago

Hello,

can you give me a code sample so i can reproduce the error?

Thanks

janicerar commented 6 years ago

I have the same problem. Ajax returns good values. But select fields are not selected.

            NovaBelongsToDepend::make('X')
                ->options(X::all())
                ->rules('required'),

            NovaBelongsToDepend::make('Y name', 'section', Y::class)
                ->optionsResolve(function ($x) {
                    return $x->y;
                })
                ->dependsOn('x')
                ->rules('required'),

            NovaBelongsToDepend::make('Z name', 'z', Z::class)
                ->optionsResolve(function ($y) {
                    return $y->z;
                })
                ->dependsOn('y')
                ->rules('required'),
orlyapps commented 6 years ago

Hello,

thanks for the report and sorry for the issue!

Should be fixed now.