You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: notifications.md
+17-17
Original file line number
Diff line number
Diff line change
@@ -336,10 +336,10 @@ In this example, we register a greeting, a line of text, a call to action, and t
336
336
> **Note**
337
337
> 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.
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:
343
343
344
344
/**
345
345
* 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
349
349
*/
350
350
public function toMail($notifiable)
351
351
{
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('...');
355
356
}
356
357
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:
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:
358
362
359
363
/**
360
364
* 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
365
369
public function toMail($notifiable)
366
370
{
367
371
return (new MailMessage)->view(
368
-
['emails.name.html', 'emails.name.plain'],
369
-
['invoice' => $this->invoice]
372
+
'emails.name', ['invoice' => $this->invoice]
370
373
);
371
374
}
372
375
373
-
<aname="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:
377
377
378
378
/**
379
379
* Get the mail representation of the notification.
@@ -383,10 +383,10 @@ Some notifications inform users of errors, such as a failed invoice payment. You
0 commit comments