Modal with relationship table crud

Our old livewire edit order page had a row of items displaying on it. one of the columns was a count of associated rows from another table, which upon clicking would open a modal displaying those rows, can anyone tell me how this is possible? Currently I just display the row count as follows..
ViewColumn::make('step_count')
->view('tables/columns/step-count')
->action(function () {
// open modal here??
})
ViewColumn::make('step_count')
->view('tables/columns/step-count')
->action(function () {
// open modal here??
})
6 Replies
Dennis Koch
Dennis Koch6d ago
Pass that method an Action object with ->modalContent()
delboy1978uk
delboy1978ukOP6d ago
ah is that how you do it?
// from docs
$action = Action::make('advance')
->action(fn (Contract $record) => $record->advance())
->modalContent(fn (Contract $record): View => view(
'filament.pages.actions.advance',
['record' => $record],
))

// and so
ViewColumn::make('step_count')
->view('tables/columns/step-count')
->action($action)
// from docs
$action = Action::make('advance')
->action(fn (Contract $record) => $record->advance())
->modalContent(fn (Contract $record): View => view(
'filament.pages.actions.advance',
['record' => $record],
))

// and so
ViewColumn::make('step_count')
->view('tables/columns/step-count')
->action($action)
like that?
Dennis Koch
Dennis Koch6d ago
Yeah, like that. But you wouldn't combine action and modalContent
delboy1978uk
delboy1978ukOP6d ago
@Dennis Koch thank you so much for your help, I now have a modal with a custom view, is it possible though to use a table object using a default filament view?
Dennis Koch
Dennis Koch6d ago
You could add a Livewire component inside that model that uses the table builder.
delboy1978uk
delboy1978ukOP6d ago
ah nice, thank you once again!

Did you find this page helpful?