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)
0 Replies