Skip to content

[5.3] Add greeting option to SimpleMessage notification#15108

Merged
taylorotwell merged 7 commits into
laravel:5.3from
balping:5.3
Aug 28, 2016
Merged

[5.3] Add greeting option to SimpleMessage notification#15108
taylorotwell merged 7 commits into
laravel:5.3from
balping:5.3

Conversation

@balping

@balping balping commented Aug 28, 2016

Copy link
Copy Markdown
Contributor

By default 'Hello!' or 'Whoops!' is displayed as greeting.

You can override this with the greeting() method:

public function toMail($notifiable)
{
    return (new MailMessage)
                ->greeting("Hi {$notifiable->name},")
                ->line('The introduction to the notification.')
                ->action('Notification Action', 'https://laravel.com')
                ->line('Thank you for using our application!');
}

By default 'Hello!' or 'Whoops!' is displayed as greeting.

You can override this with the `greeting()` method:

```
public function toMail($notifiable)
{
    return (new MailMessage)
                ->greeting("Hi {$notifiable->name},")
                ->line('The introduction to the notification.')
                ->action('Notification Action', 'https://laravel.com')
                ->line('Thank you for using our application!');
}
```
public $subject;

/**
* Greeting at the beginning of the notification.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GrahamCampbell I don't know what you mean, I added a new line, styleci is failing now

@taylorotwell

Copy link
Copy Markdown
Member

I don't like nested ternarys. Can you get rid of that?

@balping

balping commented Aug 28, 2016

Copy link
Copy Markdown
Contributor Author

@taylorotwell I replaced it with if-else : 0e193ea

@taylorotwell taylorotwell merged commit 6421e33 into laravel:5.3 Aug 28, 2016
@tillkruss

Copy link
Copy Markdown
Contributor

@balping: This broke the plain text email.

@balping

balping commented Aug 28, 2016

Copy link
Copy Markdown
Contributor Author

How so?

Is there a syntax error or something?

@tillkruss

Copy link
Copy Markdown
Contributor

There are no new lines after the greeting. I'll submit a PR to fix that.

@balping

balping commented Aug 28, 2016

Copy link
Copy Markdown
Contributor Author

Ok, thanks and sorry about this

@tillkruss

Copy link
Copy Markdown
Contributor

No worries, I love the greeting. Much more flexibility!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants