notification inside action not showing

i have code action like this but when it create, the success notification not fired how to tackle this? thank you!
->suffixAction(
Forms\Components\Actions\Action::make('newCategoryForAsset')
->icon('heroicon-m-squares-plus')
->form([
Forms\Components\TextInput::make('name')
->maxLength(255)
->required(),
Forms\Components\TextArea::make('note')
])
->mutateFormDataUsing(function (array $data): array {
$data['type'] = 'Asset';
$data['user_id'] = auth()->id();
return $data;
})
->successNotification(function (array $data){
Notification::make()
->title('Category registered')
->body('Saved new '.$data['type'].' category named '.$data['name'].'.')
->success();
})
->action(function (array $data): void {
Category::create($data);
})
),
->suffixAction(
Forms\Components\Actions\Action::make('newCategoryForAsset')
->icon('heroicon-m-squares-plus')
->form([
Forms\Components\TextInput::make('name')
->maxLength(255)
->required(),
Forms\Components\TextArea::make('note')
])
->mutateFormDataUsing(function (array $data): array {
$data['type'] = 'Asset';
$data['user_id'] = auth()->id();
return $data;
})
->successNotification(function (array $data){
Notification::make()
->title('Category registered')
->body('Saved new '.$data['type'].' category named '.$data['name'].'.')
->success();
})
->action(function (array $data): void {
Category::create($data);
})
),
Solution:
I think successNotification will be used to override the default filament actions, so you dont need it here ```php Forms\Components\Actions\Action::make('newCategoryForAsset') ->action(function (array $data): void {...
Jump to solution
5 Replies
Lara Zeus
Lara Zeus2mo ago
try add ->send() to the Notification::make
thyk123
thyk1232mo ago
Hello, thank you again for helping me I already tried that but seems the same, the notification does not show 🥹
Lara Zeus
Lara Zeus2mo ago
add it to the action after the create
thyk123
thyk1232mo ago
Oh i see, thank you so much!
Solution
Lara Zeus
Lara Zeus2mo ago
I think successNotification will be used to override the default filament actions, so you dont need it here
Forms\Components\Actions\Action::make('newCategoryForAsset')
->action(function (array $data): void {
Category::create($data);

Notification::make()
->title('Category registered')
->body('Saved new '.$data['type'].' category named '.$data['name'].'.')
->send()
->success();
})
Forms\Components\Actions\Action::make('newCategoryForAsset')
->action(function (array $data): void {
Category::create($data);

Notification::make()
->title('Category registered')
->body('Saved new '.$data['type'].' category named '.$data['name'].'.')
->send()
->success();
})