Skip to main content
Dmytro Sakharuk avatar

I can't understand what this is for?

switch ($this->notification->notification_class) {
case BookingReminder1H::class:
$this->notification->user->notify(new BookingReminder1H($this->notification->notifiable));
break;
case BookingReminder2H::class:
$this->notification->user->notify(new BookingReminder2H($this->notification->notifiable));
break;
case BookingReminder5MIN::class:
$this->notification->user->notify(new BookingReminder5MIN($this->notification->notifiable));
break;
case BookingStartedNotification::class:
$this->notification->user->notify(new BookingStartedNotification($this->notification->notifiable));
break;
}
Modestas avatar

this allows us to switch notification class based on what we saved in database. this allows us to quickly add/remove/replace notification classes

Dmytro Sakharuk avatar

Your reminder classes should simply implement the BookingReminderInterface.

Modestas avatar

This was not the goal of this lesson :)

We don't want to add complications around things, when it is not the focus of a lesson