whitecube / nova-flexible-content

Flexible Content & Repeater Fields for Laravel Nova
MIT License
778 stars 230 forks source link

BelongsTo relationship issue #487

Open msucevan opened 8 months ago

msucevan commented 8 months ago

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'))
Senexis commented 7 months ago

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

msucevan commented 7 months ago

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