Notification appears 3 times
Every time I open the edit page, or click the action, or confirm, I get a notification. How can I only get a notification after a confirm?
protected function getActions(): array
{
return [
Actions\DeleteAction::make(),
Action::make('accept')
->color('success')
->label('Accept')
->disabled(!auth()->user()->can('status_expense'))
->action(function (array $data): void {
$this->record->status = Status::where('name', 'Accepted')->first()->id;
$this->record->save();
})
->requiresConfirmation()
->successNotification(
Notification::make()
->success()
->title('Form Updated')
->body('The expense was accepted.')
->send(),
),
Action::make('reject')
->color('danger')
->label('Reject')
->disabled(!auth()->user()->can('status_expense'))
->requiresConfirmation()
->action(function (array $data): void {
$this->record->status = Status::where('name', 'Rejected')->first()->id;
$this->record->save();
})
];
}protected function getActions(): array
{
return [
Actions\DeleteAction::make(),
Action::make('accept')
->color('success')
->label('Accept')
->disabled(!auth()->user()->can('status_expense'))
->action(function (array $data): void {
$this->record->status = Status::where('name', 'Accepted')->first()->id;
$this->record->save();
})
->requiresConfirmation()
->successNotification(
Notification::make()
->success()
->title('Form Updated')
->body('The expense was accepted.')
->send(),
),
Action::make('reject')
->color('danger')
->label('Reject')
->disabled(!auth()->user()->can('status_expense'))
->requiresConfirmation()
->action(function (array $data): void {
$this->record->status = Status::where('name', 'Rejected')->first()->id;
$this->record->save();
})
];
}