Skip to content

[9.x] Added docs for lineIf and attachMany #8085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ The `MailMessage` class contains a few simple methods to help you build transact
return (new MailMessage)
->greeting('Hello!')
->line('One of your invoices has been paid!')
->lineIf($this->amount > 0, "Amount paid: {$this->amount}")
->action('View Invoice', $url)
->line('Thank you for using our application!');
}
Expand Down Expand Up @@ -532,6 +533,27 @@ Unlike attaching files in mailable objects, you may not attach a file directly f
->attachFromStorage('/path/to/file');
}

When necessary, multiple files may be attached to a message using the `attachMany` method:

/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->greeting('Hello!')
->attachMany([
'/path/to/forge.svg',
'/path/to/vapor.svg' => [
'as' => 'Logo.svg',
'mime' => 'image/svg+xml',
],
]);
}

<a name="raw-data-attachments"></a>
#### Raw Data Attachments

Expand Down