From 76a0770bd6530c3311bf544183eb5190639abbf6 Mon Sep 17 00:00:00 2001 From: Moisis Date: Thu, 30 Jun 2022 08:23:45 +0100 Subject: [PATCH] Allow more params passed on translations --- src/Notifications/CheckFailedNotification.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Notifications/CheckFailedNotification.php b/src/Notifications/CheckFailedNotification.php index ef96b070..3ce8ff70 100644 --- a/src/Notifications/CheckFailedNotification.php +++ b/src/Notifications/CheckFailedNotification.php @@ -66,7 +66,7 @@ public function toMail(): MailMessage { return (new MailMessage()) ->from(config('health.notifications.mail.from.address', config('mail.from.address')), config('health.notifications.mail.from.name', config('mail.from.name'))) - ->subject(trans('health::notifications.check_failed_mail_subject', ['application_name' => $this->applicationName()])) + ->subject(trans('health::notifications.check_failed_mail_subject', $this->transParameters())) ->markdown('health::mail.checkFailedNotification', ['results' => $this->results]); } @@ -76,7 +76,7 @@ public function toSlack(): SlackMessage ->error() ->from(config('health.notifications.slack.username'), config('health.notifications.slack.icon')) ->to(config('health.notifications.slack.channel')) - ->content(trans('health::notifications.check_failed_slack_message', ['application_name' => $this->applicationName()])); + ->content(trans('health::notifications.check_failed_slack_message', $this->transParameters())); foreach ($this->results as $result) { $slackMessage->attachment(function (SlackAttachment $attachment) use ($result) { @@ -90,11 +90,11 @@ public function toSlack(): SlackMessage return $slackMessage; } - public function applicationName(): string + public function transParameters(): array { - /** @var string $applicationName */ - $applicationName = config('app.name') ?? config('app.url') ?? 'Laravel application'; - - return $applicationName; + return [ + 'application_name' => config('app.name') ?? config('app.url') ?? 'Laravel application', + 'env_name' => app()->environment() + ]; } }