diff --git a/app/Models/CheckoutAcceptance.php b/app/Models/CheckoutAcceptance.php index 79a6da5415..45fc6ec088 100644 --- a/app/Models/CheckoutAcceptance.php +++ b/app/Models/CheckoutAcceptance.php @@ -16,12 +16,16 @@ class CheckoutAcceptance extends Model 'declined_at' => 'datetime', ]; - // Get the mail recipient from the config - public function routeNotificationForMail(): string + /** + * Get the mail recipient from the config + * + * @return mixed|string|null + */ + public function routeNotificationForMail() { // At this point the endpoint is the same for everything. // In the future this may want to be adapted for individual notifications. - return (config('mail.reply_to.address')) ? config('mail.reply_to.address') : '' ; + return Setting::getSettings()->alert_email; } /** diff --git a/app/Notifications/AcceptanceAssetAcceptedNotification.php b/app/Notifications/AcceptanceAssetAcceptedNotification.php index 93e75df7b3..ca016acd34 100644 --- a/app/Notifications/AcceptanceAssetAcceptedNotification.php +++ b/app/Notifications/AcceptanceAssetAcceptedNotification.php @@ -46,6 +46,11 @@ class AcceptanceAssetAcceptedNotification extends Notification } + public function shouldSend($notifiable, $channel) + { + return $this->settings->alerts_enabled && ! empty($this->settings->alert_email); + } + /** * Get the mail representation of the notification. * diff --git a/app/Notifications/AcceptanceAssetDeclinedNotification.php b/app/Notifications/AcceptanceAssetDeclinedNotification.php index 82a8de9210..11b022e095 100644 --- a/app/Notifications/AcceptanceAssetDeclinedNotification.php +++ b/app/Notifications/AcceptanceAssetDeclinedNotification.php @@ -44,6 +44,11 @@ class AcceptanceAssetDeclinedNotification extends Notification } + public function shouldSend($notifiable, $channel) + { + return $this->settings->alerts_enabled && ! empty($this->settings->alert_email); + } + /** * Get the mail representation of the notification. *