diff --git a/app/Abstracts/Notification.php b/app/Abstracts/Notification.php index cd3e23788..8162ff98c 100644 --- a/app/Abstracts/Notification.php +++ b/app/Abstracts/Notification.php @@ -58,6 +58,15 @@ abstract class Notification extends BaseNotification implements ShouldQueue return $message; } + /** + * Initialise the array representation of the notification. + * + */ + public function initArrayMessage(): void + { + app('url')->defaults(['company_id' => company_id()]); + } + public function getSubject(): string { return !empty($this->custom_mail['subject']) diff --git a/app/Notifications/Banking/Transaction.php b/app/Notifications/Banking/Transaction.php index b86399c5c..1aa65343c 100644 --- a/app/Notifications/Banking/Transaction.php +++ b/app/Notifications/Banking/Transaction.php @@ -74,6 +74,8 @@ class Transaction extends Notification */ public function toArray($notifiable): array { + $this->initArrayMessage(); + return [ 'template_alias' => $this->template->alias, 'title' => trans('notifications.menu.' . $this->template->alias . '.title'), diff --git a/app/Notifications/Portal/PaymentReceived.php b/app/Notifications/Portal/PaymentReceived.php index 247865de1..0f0b63bac 100644 --- a/app/Notifications/Portal/PaymentReceived.php +++ b/app/Notifications/Portal/PaymentReceived.php @@ -82,6 +82,8 @@ class PaymentReceived extends Notification */ public function toArray($notifiable): array { + $this->initArrayMessage(); + return [ 'template_alias' => $this->template->alias, 'title' => trans('notifications.menu.' . $this->template->alias . '.title'), diff --git a/app/Notifications/Purchase/Bill.php b/app/Notifications/Purchase/Bill.php index 9d255a563..666aaa457 100644 --- a/app/Notifications/Purchase/Bill.php +++ b/app/Notifications/Purchase/Bill.php @@ -54,6 +54,8 @@ class Bill extends Notification */ public function toArray($notifiable): array { + $this->initArrayMessage(); + return [ 'template_alias' => $this->template->alias, 'title' => trans('notifications.menu.' . $this->template->alias . '.title'), diff --git a/app/Notifications/Purchase/Payment.php b/app/Notifications/Purchase/Payment.php index 49dbefddf..55f8173ab 100644 --- a/app/Notifications/Purchase/Payment.php +++ b/app/Notifications/Purchase/Payment.php @@ -77,6 +77,8 @@ class Payment extends Notification */ public function toArray($notifiable) { + $this->initArrayMessage(); + return [ 'template_alias' => $this->template->alias, 'title' => trans('notifications.menu.' . $this->template->alias . '.title'), diff --git a/app/Notifications/Sale/Invoice.php b/app/Notifications/Sale/Invoice.php index 8ec826a69..db766d507 100644 --- a/app/Notifications/Sale/Invoice.php +++ b/app/Notifications/Sale/Invoice.php @@ -78,6 +78,8 @@ class Invoice extends Notification */ public function toArray($notifiable): array { + $this->initArrayMessage(); + return [ 'template_alias' => $this->template->alias, 'title' => trans('notifications.menu.' . $this->template->alias . '.title'),