© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
Prosp30

Update pivot table when editing record

Hi there,

I am trying to update a pivot table record while editing the main record.

I have the following table

team_user
user_id
team_id
operator_id (just a string value I wish to update)

On both user and team I have belongsToMany (M:M relationship).

This is how I fetch the operator_id in the table, using the team_user pivot table

TextColumn::make('operator_id')->label('Oznaka operatera')->sortable()->searchable()
                    ->state(function (User $record): string {
                        return $record->getUserInTeam()->first()->pivot->operator_id;
                    }),
TextColumn::make('operator_id')->label('Oznaka operatera')->sortable()->searchable()
                    ->state(function (User $record): string {
                        return $record->getUserInTeam()->first()->pivot->operator_id;
                    }),


How can I acomplish the same so when the record is created, operator_id is filled from the form and when the record is being edited, operator ID gets displayed and can be edited?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Editing pivot table relating 3 tables
FilamentFFilament / ❓┊help
3y ago
Reordering records with order record in a pivot table
FilamentFFilament / ❓┊help
3y ago
Update data on pivot table
FilamentFFilament / ❓┊help
2y ago
Displaying related pivot record details on table
FilamentFFilament / ❓┊help
2y ago