whitecube/nova-flexible-content

BelongsTo relationship issue

msucevan opened this issue · 2 comments

Basically, when I'm using BelongsTo field outside the addLayout is working good.

But when I'm trying to use a Flexible field and I'm trying to use BelongsTo inside addLayout method this is not working.

            Flexible::make(__('Parameter'), 'parameter')
                ->addLayout(__('Parameter'), 'parameter', [
                    BelongsTo::make(__('Param'), 'param', Param::class)
                        ->sortable()
                        ->rules('required'),
                ])
                ->button(__('Add Parameter'))

As a workaround, you can use a Select field with pluck() to list all your relations, but this would be nice to have regardless.

Thank you for the reply. I was just wondering if was supported or not, I will use the workaround that you mentioned