Skip to content

Commit

Permalink
Add salutation option to SimpleMessage notification (#17429)
Browse files Browse the repository at this point in the history
  • Loading branch information
seblavoie authored and taylorotwell committed Jan 20, 2017
1 parent e8adf44 commit 1b9bfe2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
21 changes: 21 additions & 0 deletions src/Illuminate/Notifications/Messages/SimpleMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class SimpleMessage
*/
public $greeting;

/**
* The notification's salutation.
*
* @var string
*/
public $salutation;

/**
* The "intro" lines of the notification.
*
Expand Down Expand Up @@ -118,6 +125,19 @@ public function greeting($greeting)
return $this;
}

/**
* Set the salutation of the notification.
*
* @param string $salutation
* @return $this
*/
public function salutation($salutation)
{
$this->salutation = $salutation;

return $this;
}

/**
* Add a line of text to the notification.
*
Expand Down Expand Up @@ -189,6 +209,7 @@ public function toArray()
'level' => $this->level,
'subject' => $this->subject,
'greeting' => $this->greeting,
'salutation' => $this->salutation,
'introLines' => $this->introLines,
'outroLines' => $this->outroLines,
'actionText' => $this->actionText,
Expand Down
7 changes: 5 additions & 2 deletions src/Illuminate/Notifications/resources/views/email.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
@endforeach

<!-- Salutation -->
Regards,<br>
{{ config('app.name') }}
@if (! empty($salutation))
{{ $salutation }}
@else
Regards,<br>{{ config('app.name') }}
@endif

<!-- Subcopy -->
@if (isset($actionText))
Expand Down

0 comments on commit 1b9bfe2

Please sign in to comment.