mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-30 13:11:08 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| namespace Crater\Mail;
 | |
| 
 | |
| use Crater\Models\EmailLog;
 | |
| use Crater\Models\Invoice;
 | |
| use Illuminate\Bus\Queueable;
 | |
| use Illuminate\Mail\Mailable;
 | |
| use Illuminate\Queue\SerializesModels;
 | |
| use Illuminate\Contracts\Queue\ShouldQueue;
 | |
| 
 | |
| class SendInvoiceMail 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' => Invoice::class,
 | |
|             'mailable_id' => $this->data['invoice']['id']
 | |
|         ]);
 | |
| 
 | |
|         return $this->from($this->data['from'])
 | |
|                     ->subject($this->data['subject'])
 | |
|                     ->markdown('emails.send.invoice', ['data', $this->data]);
 | |
|     }
 | |
| }
 |