© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•17mo ago•
3 replies
Rolland

Interact with Pivot attributes in Relation Manager

Tables\Columns\ToggleColumn::make('is_active')
                    ->label(__('department.attributes.is_active'))
                    ->onIcon('heroicon-o-eye')
                    ->offIcon('heroicon-o-eye-slash')
Tables\Columns\ToggleColumn::make('is_active')
                    ->label(__('department.attributes.is_active'))
                    ->onIcon('heroicon-o-eye')
                    ->offIcon('heroicon-o-eye-slash')


I wanted to update the
is_active
is_active
but it is not updating. not sure what i did wrong here.

Department model:
public function userHasDepartments(): BelongsToMany
    {
        return $this->belongsToMany(User::class, 'user_has_department')
            ->withPivot(['is_active'])
            ->withTimestamps();
    }
public function userHasDepartments(): BelongsToMany
    {
        return $this->belongsToMany(User::class, 'user_has_department')
            ->withPivot(['is_active'])
            ->withTimestamps();
    }
Solution
i found a solution:
Tables\Columns\ToggleColumn::make('is_active')
    ->getStateUsing(fn ($record) => $record->pivot->is_active) <--- add this
    ->sortable()
    ->onIcon('heroicon-o-eye')
    ->offIcon('heroicon-o-eye-slash')
    ->label('Status'),           
Tables\Columns\ToggleColumn::make('is_active')
    ->getStateUsing(fn ($record) => $record->pivot->is_active) <--- add this
    ->sortable()
    ->onIcon('heroicon-o-eye')
    ->offIcon('heroicon-o-eye-slash')
    ->label('Status'),           
Jump to solution
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

Pivot cast in relation manager
FilamentFFilament / ❓┊help
2y ago
How to show / edit pivot attributes in a relation manager
FilamentFFilament / ❓┊help
3y ago
Relation Manager with Pivot and ordering on pivot
FilamentFFilament / ❓┊help
3y ago
Relation Manager with repeater and pivot
FilamentFFilament / ❓┊help
11mo ago