F
Filament4mo 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 Zeus4mo 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
ArjanOP4mo ago
Thanks Lara! This is the solution.

Did you find this page helpful?