© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
torriv

Showing pivot data in infolist

i'm trying to show some data from a pivot table in my infolist.

The infolist is like this:
    public static function infolist(Infolist $infolist) : Infolist{

        return $infolist
            ->schema([
               TextEntry::make('program_name'),
                RepeatableEntry::make('WorkoutExercises')
                    ->schema([
                        TextEntry::make('exercise_name')->label('Øvelse'),
                        TextEntry::make('repetitions')->label('Reps'),
                        TextEntry::make('sets')->label('Set'),
                        TextEntry::make('rest')->label('Pause'),
                    ])
                    ->columns(4)
            ]);
    }
    public static function infolist(Infolist $infolist) : Infolist{

        return $infolist
            ->schema([
               TextEntry::make('program_name'),
                RepeatableEntry::make('WorkoutExercises')
                    ->schema([
                        TextEntry::make('exercise_name')->label('Øvelse'),
                        TextEntry::make('repetitions')->label('Reps'),
                        TextEntry::make('sets')->label('Set'),
                        TextEntry::make('rest')->label('Pause'),
                    ])
                    ->columns(4)
            ]);
    }


The 'exercise_name' is showing, but that is from the parent table. but the rest is in the pivot table. i've tried to add the name of the pivot table, but that didn't work either. (like 'nameOfPivotTable.repetitions')
Solution
for the moment i solved it doing this:
        return $infolist
            ->schema([
               TextEntry::make('program_name'),
                RepeatableEntry::make('WorkoutExercises')
                    ->schema([
                        TextEntry::make('exercise_name')->label('Øvelse'),
                        TextEntry::make('repetitions')
                            ->getStateUsing(fn (WorkoutExercise $record): string => $record->pivot->repetitions)
                            ->label('Reps'),
                        TextEntry::make('sets')
                            ->getStateUsing(fn (WorkoutExercise $record): string => $record->pivot->sets)
                            ->label('Set'),
                        TextEntry::make('rest')
                            ->getStateUsing(fn (WorkoutExercise $record): string => $record->pivot->rest)
                            ->label('Pause'),
                    ])
                    ->columns(4)
            ]);
        return $infolist
            ->schema([
               TextEntry::make('program_name'),
                RepeatableEntry::make('WorkoutExercises')
                    ->schema([
                        TextEntry::make('exercise_name')->label('Øvelse'),
                        TextEntry::make('repetitions')
                            ->getStateUsing(fn (WorkoutExercise $record): string => $record->pivot->repetitions)
                            ->label('Reps'),
                        TextEntry::make('sets')
                            ->getStateUsing(fn (WorkoutExercise $record): string => $record->pivot->sets)
                            ->label('Set'),
                        TextEntry::make('rest')
                            ->getStateUsing(fn (WorkoutExercise $record): string => $record->pivot->rest)
                            ->label('Pause'),
                    ])
                    ->columns(4)
            ]);
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Infolist missing record with BelongsToMany and Pivot data
FilamentFFilament / ❓┊help
2mo ago
Infolist not showing
FilamentFFilament / ❓┊help
3y ago
Insert Data in Pivot Table
FilamentFFilament / ❓┊help
3y ago
sortable pivot data
FilamentFFilament / ❓┊help
3y ago