F
Filament2mo ago
Arjan

successNotificationTitle for table action is not showing

The successNotificationTitle for my (custom) action is not showing after the action has been successfully executed. Does anyone know why? This is my code:
Tables\Actions\Action::make('Watchlist')
->color('warning')
->icon(MyWatchlistResource::getNavigationIcon())
->successNotificationTitle('Project added to your watchlist')
->action(function (Project $record) {
Watchlist::updateOrCreate([
'project_id' => $record->id,
'user_id' => auth()->user()->id,
]);
}),
Tables\Actions\Action::make('Watchlist')
->color('warning')
->icon(MyWatchlistResource::getNavigationIcon())
->successNotificationTitle('Project added to your watchlist')
->action(function (Project $record) {
Watchlist::updateOrCreate([
'project_id' => $record->id,
'user_id' => auth()->user()->id,
]);
}),
Solution:
you need to call success like ```php ->action(function (Tables\Actions\Action $action) { // your action... ...
Jump to solution
2 Replies
Solution
Lara Zeus
Lara Zeus2mo ago
you need to call success like
->action(function (Tables\Actions\Action $action) {
// your action...

$action->success();
})
->action(function (Tables\Actions\Action $action) {
// your action...

$action->success();
})
Arjan
ArjanOP5w ago
Thanks Lara! This is the solution.
Want results from more Discord servers?
Add your server