Notifications

Guys, have you ever had a problem with notifications?

I'm making an insertion in my customers table and I needed a notification to be displayed when registered.

Registration takes place through an end-point on a route that I created to receive an external request.

Reading the documentation I saw databaseNotifications.

There in my AdminPanelProvider I placed the property:
->databaseNotifications();

So far, it was a great show, it ran smoothly and appeared on the panel.

Then I ran the notification migration, everything was fine too.

I created a CustomerObserver observer, and in the creation function I did:
    public function created(Customer $customer): void
    {
        Notification::make()
            ->title('Saved successfully')
            ->body('Customer created successfully')
            ->sendToDatabase($customer);
    }



Also, in my EventServiceProvider in the method:

    public function boot(): void
    {
        Customer::observe(CustomerObserver::class);
    }


I made this modification.

However, despite everything, the notification was not registered in the bd nor displayed.
Was this page helpful?