Enable invoice emailing
This commit is contained in:
47
app/Mail/InvoiceEmail.php
Normal file
47
app/Mail/InvoiceEmail.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
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,
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user