ctrlpanel/app/Notifications/InvoiceNotification.php
2021-11-30 14:09:13 +01:00

57 lines
1.1 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\Server;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use LaravelDaily\Invoices\Invoice;
class InvoiceNotification extends Notification
{
use Queueable;
/**
* @var invoice
*/
private $invoice;
/**
* Create a new notification instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice)
{
$this->invoice = $invoice;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->subject('Your Invoice!')
->greeting('Your invoice is ready')
->line("Skurr skurr.")
->line('damn son.')
->attach($this->invoice->stream());
}
}