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,
]);
}),
1 Reply
Lara Zeus
Lara Zeus3d 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();
})
Want results from more Discord servers?
Add your server