© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
5 replies
F alko

Format Pivot fields in Relation Manager

This is the table of my RelationManager.
I have a many-to-many relation with a view properties on my pivot.
I would like to add multiple pivot values together, but can't seem to find a way to do this.

Let's say I have a
User
User
object with a many-to-many relation with
Subscription
Subscription
.
This many-to-many has a Pivot model called
SubscriptionUser
SubscriptionUser
and pivot fields
active
active
and
expires_at
expires_at
:

public function table(Table $table): Table
{
    return $table
        ->allowDuplicates()
        ->columns([
            Tables\Columns\TextColumn::make('some_pivot_field')
                ->formatStateUsing(function ($state, $record) {
                    // Here I would like to access UserRole.
                    // I want to be able to see every subscription and make the `active` state orange when expires at is within a month.
                    // This is not my actual use-case.
                }),
        ]);
}
public function table(Table $table): Table
{
    return $table
        ->allowDuplicates()
        ->columns([
            Tables\Columns\TextColumn::make('some_pivot_field')
                ->formatStateUsing(function ($state, $record) {
                    // Here I would like to access UserRole.
                    // I want to be able to see every subscription and make the `active` state orange when expires at is within a month.
                    // This is not my actual use-case.
                }),
        ]);
}
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
Reordable pivot table in Relation Manager
FilamentFFilament / ❓┊help
3y ago
Relation Manager for pivot table
FilamentFFilament / ❓┊help
2y ago
Interact with Pivot attributes in Relation Manager
FilamentFFilament / ❓┊help
17mo ago