Skip to content

Commit 7f20439

Browse files
committed
wip
1 parent 72ebaf8 commit 7f20439

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

notifications.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,10 @@ In this example, we register a greeting, a line of text, a call to action, and t
336336
> **Note**
337337
> When sending mail notifications, be sure to set the `name` configuration option in your `config/app.php` configuration file. This value will be used in the header and footer of your mail notification messages.
338338
339-
<a name="other-mail-notification-formatting-options"></a>
340-
#### Other Mail Notification Formatting Options
339+
<a name="error-messages"></a>
340+
#### Error Messages
341341

342-
Instead of defining the "lines" of text in the notification class, you may use the `view` method to specify a custom template that should be used to render the notification email:
342+
Some notifications inform users of errors, such as a failed invoice payment. You may indicate that a mail message is regarding an error by calling the `error` method when building your message. When using the `error` method on a mail message, the call to action button will be red instead of black:
343343

344344
/**
345345
* Get the mail representation of the notification.
@@ -349,12 +349,16 @@ Instead of defining the "lines" of text in the notification class, you may use t
349349
*/
350350
public function toMail($notifiable)
351351
{
352-
return (new MailMessage)->view(
353-
'emails.name', ['invoice' => $this->invoice]
354-
);
352+
return (new MailMessage)
353+
->error()
354+
->subject('Invoice Payment Failed')
355+
->line('...');
355356
}
356357

357-
You may specify a plain-text view for the mail message by passing the view name as the second element of an array that is given to the `view` method:
358+
<a name="other-mail-notification-formatting-options"></a>
359+
#### Other Mail Notification Formatting Options
360+
361+
Instead of defining the "lines" of text in the notification class, you may use the `view` method to specify a custom template that should be used to render the notification email:
358362

359363
/**
360364
* Get the mail representation of the notification.
@@ -365,15 +369,11 @@ You may specify a plain-text view for the mail message by passing the view name
365369
public function toMail($notifiable)
366370
{
367371
return (new MailMessage)->view(
368-
['emails.name.html', 'emails.name.plain'],
369-
['invoice' => $this->invoice]
372+
'emails.name', ['invoice' => $this->invoice]
370373
);
371374
}
372375

373-
<a name="error-messages"></a>
374-
#### Error Messages
375-
376-
Some notifications inform users of errors, such as a failed invoice payment. You may indicate that a mail message is regarding an error by calling the `error` method when building your message. When using the `error` method on a mail message, the call to action button will be red instead of black:
376+
You may specify a plain-text view for the mail message by passing the view name as the second element of an array that is given to the `view` method:
377377

378378
/**
379379
* Get the mail representation of the notification.
@@ -383,10 +383,10 @@ Some notifications inform users of errors, such as a failed invoice payment. You
383383
*/
384384
public function toMail($notifiable)
385385
{
386-
return (new MailMessage)
387-
->error()
388-
->subject('Notification Subject')
389-
->line('...');
386+
return (new MailMessage)->view(
387+
['emails.name.html', 'emails.name.plain'],
388+
['invoice' => $this->invoice]
389+
);
390390
}
391391

392392
<a name="customizing-the-sender"></a>

0 commit comments

Comments
 (0)