© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•11mo ago•
1 reply
neverender24

Pass data from blade to Resource with modalContent

Hi how can I pass data from my filament.components.routes

I putted {{ $action->getModalAction('report')}}. just like in the documentation but I want to pass the id once I click the action

Action::make('route')
                    ->registerModalActions([
                        Action::make('report')
                            ->action(fn($data) => dd($data)) // this returns empty array,
                    ])
                    ->modalContent(function (Action $action, $record) {
                        $record = Route::with(['user', 'process_from', 'process_to'])
                            ->where('barcode', $record->barcode)
                            // ->orderBy('transact_at', 'desc')
                            ->get();

                        $totalTravelTime = $record->toQuery()->sum('travel_time');
                        $totalOfficeTime = $record->toQuery()->sum('office_time');
                        $barcode = $record->toQuery()->first(['barcode']);

                        $location = $record->toQuery()->first();

                        return view('filament.components.routes', [
                            'records' => $record,
                            'totalTravelTime' => $totalTravelTime,
                            'totalOfficeTime' => $totalOfficeTime,
                            'barcode' => $barcode->barcode,
                            'location' => $location->process_from->office_prefix,
                            'action' => $action
                        ]);
                    })
                    ->action(fn($record) => $record->route())
                    ->modalHeading('Data Table')
                    ->modalWidth('3xl')
                    ->modalSubmitAction(false)
Action::make('route')
                    ->registerModalActions([
                        Action::make('report')
                            ->action(fn($data) => dd($data)) // this returns empty array,
                    ])
                    ->modalContent(function (Action $action, $record) {
                        $record = Route::with(['user', 'process_from', 'process_to'])
                            ->where('barcode', $record->barcode)
                            // ->orderBy('transact_at', 'desc')
                            ->get();

                        $totalTravelTime = $record->toQuery()->sum('travel_time');
                        $totalOfficeTime = $record->toQuery()->sum('office_time');
                        $barcode = $record->toQuery()->first(['barcode']);

                        $location = $record->toQuery()->first();

                        return view('filament.components.routes', [
                            'records' => $record,
                            'totalTravelTime' => $totalTravelTime,
                            'totalOfficeTime' => $totalOfficeTime,
                            'barcode' => $barcode->barcode,
                            'location' => $location->process_from->office_prefix,
                            'action' => $action
                        ]);
                    })
                    ->action(fn($record) => $record->route())
                    ->modalHeading('Data Table')
                    ->modalWidth('3xl')
                    ->modalSubmitAction(false)
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

pass data to blade
FilamentFFilament / ❓┊help
3y ago
Can't pass parameters from resource to livewire blade
FilamentFFilament / ❓┊help
2y ago
ModalContent inputs pass to action()
FilamentFFilament / ❓┊help
12mo ago
How to pass data from view to Resource TextInput?
FilamentFFilament / ❓┊help
2y ago