© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•4mo ago•
6 replies
Merdin

Infolist is the same for all the records.

I'm trying to list courses in sections (instead of a table). But for every course it returns the same data (data of the last course) in the infolist. The header and the description of the course are displayed correctly.

public function content(Schema $schema): Schema
    {
        return $schema
            ->columns([
                'default' => 3,
            ])
            ->components($this->getTableRecords()->sortBy('start_at')->map(function ($course) use ($schema) {

                $infolist = CourseResource::infolist($schema)->record($course)->getFlatComponents(withAbsoluteKeys: true);

                unset($infolist['name']);
                unset($infolist['description']);
                unset($infolist['start_enrollment_at']);
                unset($infolist['end_enrollment_at']);

                return Section::make($course->name)
                    ->model($course)
                    ->description($course->description)
                    ->schema([
                        ...$infolist,
                        Action::make('view')
                            ->label('Bekijk cursus')
                            ->url(fn () => ViewCourse::getUrl(['record' => $course]))
                            ->button(),
                ]);
            })->toArray());
    }
public function content(Schema $schema): Schema
    {
        return $schema
            ->columns([
                'default' => 3,
            ])
            ->components($this->getTableRecords()->sortBy('start_at')->map(function ($course) use ($schema) {

                $infolist = CourseResource::infolist($schema)->record($course)->getFlatComponents(withAbsoluteKeys: true);

                unset($infolist['name']);
                unset($infolist['description']);
                unset($infolist['start_enrollment_at']);
                unset($infolist['end_enrollment_at']);

                return Section::make($course->name)
                    ->model($course)
                    ->description($course->description)
                    ->schema([
                        ...$infolist,
                        Action::make('view')
                            ->label('Bekijk cursus')
                            ->url(fn () => ViewCourse::getUrl(['record' => $course]))
                            ->button(),
                ]);
            })->toArray());
    }
Solution
Seems like I fixed it by adding
->state(fn ($record) => $record->the_attribute_name))
->state(fn ($record) => $record->the_attribute_name))
to all the components in the infolist.
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 same row with widget
FilamentFFilament / ❓┊help
7mo ago
Hide all records in the table
FilamentFFilament / ❓┊help
2y ago
Two list records for same resource active nav
FilamentFFilament / ❓┊help
16mo ago
Manually deselect all records
FilamentFFilament / ❓┊help
3y ago