diff --git a/src/Illuminate/Notifications/Messages/SimpleMessage.php b/src/Illuminate/Notifications/Messages/SimpleMessage.php index 25187ecc1d39..03bfa8893bf7 100644 --- a/src/Illuminate/Notifications/Messages/SimpleMessage.php +++ b/src/Illuminate/Notifications/Messages/SimpleMessage.php @@ -20,6 +20,14 @@ class SimpleMessage */ public $subject; + /** + * Greeting at the beginning of the notification. + * If null, a greeting depending on the level will be displayed. + * + * @var string|null + */ + public $greeting = null; + /** * The "intro" lines of the notification. * @@ -98,6 +106,19 @@ public function subject($subject) return $this; } + /** + * Set the greeting of the notification. + * + * @param string $greeting + * @return $this + */ + public function greeting($greeting) + { + $this->greeting = $greeting; + + return $this; + } + /** * Add a line of text to the notification. * @@ -168,6 +189,7 @@ public function toArray() return [ 'level' => $this->level, 'subject' => $this->subject, + 'greeting' => $this->greeting, 'introLines' => $this->introLines, 'outroLines' => $this->outroLines, 'actionText' => $this->actionText, diff --git a/src/Illuminate/Notifications/resources/views/email-plain.blade.php b/src/Illuminate/Notifications/resources/views/email-plain.blade.php index f5b35c0115bf..4c48197e01d6 100644 --- a/src/Illuminate/Notifications/resources/views/email-plain.blade.php +++ b/src/Illuminate/Notifications/resources/views/email-plain.blade.php @@ -1,4 +1,11 @@ -{{ $level == 'error' ? 'Whoops!' : 'Hello!' }} +

- @if ($level == 'error') - Whoops! + @if ($greeting !== null) + {{ $greeting }} @else - Hello! + @if ($level == 'error') + Whoops! + @else + Hello! + @endif @endif