mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
build version 400
This commit is contained in:
48
app/Mail/SendEstimateMail.php
Normal file
48
app/Mail/SendEstimateMail.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace Crater\Mail;
|
||||
|
||||
use Crater\Models\EmailLog;
|
||||
use Crater\Models\Estimate;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class SendEstimateMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $data = [];
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
EmailLog::create([
|
||||
'from' => $this->data['from'],
|
||||
'to' => $this->data['to'],
|
||||
'subject' => $this->data['subject'],
|
||||
'body' => $this->data['body'],
|
||||
'mailable_type' => Estimate::class,
|
||||
'mailable_id' => $this->data['estimate']['id']
|
||||
]);
|
||||
|
||||
return $this->from($this->data['from'])
|
||||
->subject($this->data['subject'])
|
||||
->markdown('emails.send.estimate', ['data', $this->data]);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user