Skip to content

Doesn't work inside BelongsToMany field #24

@jamespavett

Description

@jamespavett

Trying to use the Items field within a BelongtoMany field, and the inputted values aren't being passed in the request.

BelongsToMany::make('Individual Site Queries', 'sites', SiteResource::class)->fields(function () {
                return [
                    Text::make('Version', 'version')->sortable()->readonly(),
                    Text::make('Query File', 'query_file')->hideWhenCreating()->readonly()->sortable(),
                    Boolean::make('Template Syntax', 'template_syntax')->sortable()->help('Does this query support Array injection via PHP variables?'),
                    Items::make('Headers', 'headers')->draggable(),
                    Code::make('SQL Query')->resolveUsing(function () {
                        return isset($this->pivot) && $this->pivot->query_file ? Storage::get($this->pivot->query_file) : null;
                    })->rules('required')->language('sql')->temporary(),

                ];
            }),

Have tried referencing column via sites.headers and leaving second parameter blank, but always get the same output. No error on frontend however field in database doesn't update. Works outside of BelongsToMany field though just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions