osb/app/Mail/InvoiceEmail.php

47 lines
865 B
PHP
Raw Normal View History

2020-05-25 07:45:17 +00:00
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
2020-05-25 07:45:17 +00:00
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use App\Models\Invoice;
class InvoiceEmail extends Mailable
{
use Queueable, SerializesModels;
public $invoice;
/**
* Create a new message instance.
*
* @param Invoice $o
* @param string $notes
*/
public function __construct(Invoice $o)
{
$this->invoice = $o;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this
->markdown('email.user.invoice')
->subject(sprintf( 'Invoice: %s - Total: $%s - Due: %s',
$this->invoice->id,
number_format($this->invoice->total,2),
$this->invoice->date_due))
->with([
'user'=>$this->invoice->account->user,
'site'=>$this->invoice->account->user->site,
]);
}
}