message = "❌ Database backup for {$database->name} with frequency of $backup->frequency was FAILED."; } public function via(object $notifiable): array { $channels = []; $isEmailEnabled = data_get($notifiable, 'smtp_enabled'); $isDiscordEnabled = data_get($notifiable, 'discord_enabled'); $isSubscribedToEmailEvent = data_get($notifiable, 'smtp_notifications_database_backups'); $isSubscribedToDiscordEvent = data_get($notifiable, 'discord_notifications_database_backups'); if ($isEmailEnabled && $isSubscribedToEmailEvent) { $channels[] = EmailChannel::class; } if ($isDiscordEnabled && $isSubscribedToDiscordEvent) { $channels[] = DiscordChannel::class; } ray($channels); return $channels; } public function toMail(): MailMessage { $mail = new MailMessage(); $mail->subject("❌ Backup FAILED for {$this->database->name}"); $mail->line($this->message); return $mail; } public function toDiscord(): string { return $this->message; } }