FilamentF
Filamentβ€’2y ago
maltebaer

passing data to infolist action

hey friends πŸ‘‹πŸ½,

i want to use filament to display repeatable data, like in some kind of accordion.

i use the infolist builder, passing my data via state(). now my data includes details that i want to show inside a modal. i want to trigger the modal from within the section body, not the header. my idea is as follows:

public function fooInfolist(Infolist $infolist): Infolist
{
    return $infolist
        ->state($this->foo)
        ->schema([
            RepeatableEntry::make('foo')
                ->schema([
                    Section::make('name')
                        ->collapsible()
                        ->schema([
                            TextEntry::make('name'),
                            ViewEntry::make('bar')
                                ->view('bar')
                                ->registerActions([
                                    Action::make('showDetails')
                                        ->modalContent(view('bar-details'))
                                        ->infolist([
                                            Tabs::make('Tabs')
                                                ->tabs([
                                                    Tab::make('Tab 1')
                                                        ->schema([
                                                            TextEntry::make('bar.name')
                                                        ]),
                                                ])
                                        ])
                                ]),
                        ])
                ])
        ]);
}


the setup works fine. i have multiple cards and i can open the modal. my problem is, that i'm not able to pass the data (here bar) inside the modal. i have two ideas, either create a custom view bar-details.blade or, even better, use another infolist builder inside the modal.

do you folks have any idea? or maybe even a completely different approach?
Was this page helpful?