D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
forge
/
developers.ghanempharmacy.com
/
app
/
Mail
/
Filename :
SendMail.php
back
Copy
<?php namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Mail\Mailables\Attachment; use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Envelope; use Illuminate\Queue\SerializesModels; class SendMail extends Mailable { use Queueable, SerializesModels; protected $data; protected $template; protected $socialMedia; /** * Create a new message instance. */ public function __construct($data, $template, $socialMedia) { $this->data = $data; $this->template = $template; $this->socialMedia = $socialMedia; } /** * Get the message envelope. */ public function envelope(): Envelope { return new Envelope( subject: $this->data['subject'], ); } /** * Get the message content definition. */ public function content(): Content { return new Content( view: 'email-templates.index', with: ['data' => $this->data, 'template' => $this->template, 'socialMedia' => $this->socialMedia] ); } /** * Get the attachments for the message. * * @return array<int, Attachment> */ public function attachments(): array { if (isset($this->data['attachmentPath'])) { return [ Attachment::fromPath($this->data['attachmentPath']) ->as('invoice.pdf') ->withMime('application/pdf') ]; } return []; } }