How to attach file in Notification Laravel 9 code answer – 2024

In this article, we will learn about how to laravel notification attach file

1). laravel notification attach file

Source: stackoverflow.com

/**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)
                    ->line('Please download the PDF.')
                    ->attach(public_path($this->filename), [
                        'as' => 'filename.pdf',
                        'mime' => 'text/pdf',
                    ]);
    }

Discover more from STRUGGLER KING.COM

Subscribe now to keep reading and get access to the full archive.

Continue Reading