mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-30 21:21:09 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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]);
 | |
| 
 | |
|     }
 | |
| }
 |