Notification

I am looking to send notifications on a stand alone table (not part of the admin panel). It is a bulk action on a relationship. The action is being run under a DB:: transaction. If the transaction is successful I want to show a notification for success and otherwise I want to show a notification for failure.

I have tried to set

->successNotification
      (
                Notification::make()
                                ->title('Students added.')
                                ->success()
                                ->send()
      )
->failureNotification
      (
                Notification::make()
                                ->title('Students could not be added.')
                                ->warning ()
                                ->send()
      )



But this shows the notification as soon as the table is loaded. I am not sure how to fix this. Thanks in advance for any possible way to fix it.
Was this page helpful?