Form: Adding user-defined pivot data to belongsToMany relationship

I have a form like this:
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                CheckboxList::make('allowedTargets')
                    ->disabledOn('edit')
                    ->relationship(name: 'allowedTargets', titleAttribute: 'name')
                    ->pivotData([
                        TextInput::make('allowed_file_extensions')
                            ->label('Allowed File Extensions')
                            ->required(),
                    ])              
            ]);
    }


allowedTargets is a many-to-many-relationship of my Model. Each target has a pivot column allowed_file_extensions which accepts an array of file extensions as strings.

Using a TextInput inside the pivotData()-method is not doing anything. But it is also not documented and was just an example what I already tried. I want the user be able to add allowed_file_extensions as pivot data on the create page of my Model. So he is able to create the parent model directly with the relationship and the specific pivot data. Is that possible?

I also tried it using a RelationManager but it seems like RelationManagers don't show up on the resource create page.
Was this page helpful?