F
Filament13mo ago
Panda

Updating record via modal footer action

I have a simple resource and showing details in a modal using Info-list builder. I've added custom action in footer of the model (as shown in image) and want to update the record when the action is triggered. For this I've added the action method on custom action but when I click on the button, it shows a loading spinner in button and then nothing happens the record is not updated. Following is my code any help would be much appreciated.
public static function table(Table $table): Table
{
return $table
->columns([/* ... */])
->filters([ /* ... */ ])
->actions([
Tables\Actions\ViewAction::make()
->modalFooterActions([
Action::make('close_modal')
->label(fn () => __('filament-actions::modal.actions.cancel.label'))
->close()
->color('gray'),

//
Action::make('resolve')
->label('Mark Resolved')
->visible(fn (ContentReport $record) => !$record->resolved)
// It was $record->update(['resolved' => true]) but even the
// `dd` function is not being called
->action(fn (ContentReport $record) => dd($record))
->color('success'),
]),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([/* ... */])
->filters([ /* ... */ ])
->actions([
Tables\Actions\ViewAction::make()
->modalFooterActions([
Action::make('close_modal')
->label(fn () => __('filament-actions::modal.actions.cancel.label'))
->close()
->color('gray'),

//
Action::make('resolve')
->label('Mark Resolved')
->visible(fn (ContentReport $record) => !$record->resolved)
// It was $record->update(['resolved' => true]) but even the
// `dd` function is not being called
->action(fn (ContentReport $record) => dd($record))
->color('success'),
]),
]);
}
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server