attach mail

This commit is contained in:
WBLKLeipe 2021-11-30 14:09:13 +01:00
parent 21b9d70035
commit 67d0b66091
3 changed files with 11 additions and 11 deletions

3
.gitignore vendored
View file

@ -17,5 +17,4 @@ npm-debug.log
yarn-error.log yarn-error.log
.gitignore .gitignore
.env.dev .env.dev
.env.testing .env.testing
public/vendor/invoices/logo.png

View file

@ -4,6 +4,7 @@ namespace App\Notifications;
use App\Models\Server; use App\Models\Server;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification; use Illuminate\Notifications\Notification;
use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Invoice;
@ -34,22 +35,22 @@ class InvoiceNotification extends Notification
*/ */
public function via($notifiable) public function via($notifiable)
{ {
return ['database']; return ['mail'];
} }
/** /**
* Get the array representation of the notification. * Get the array representation of the notification.
* *
* @param mixed $notifiable * @param mixed $notifiable
* @return array * @return MailMessage
*/ */
public function toArray($notifiable) public function toMail($notifiable)
{ {
return [ return (new MailMessage)
'title' => "Invoice Created: Nr.".$this->invoice->sequence, ->subject('Your Invoice!')
'content' => " ->greeting('Your invoice is ready')
<p>Find it <a href='".$this->invoice->url()."'>here</a>.</p> ->line("Skurr skurr.")
", ->line('damn son.')
]; ->attach($this->invoice->stream());
} }
} }

View file

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB