| Current Path : /var/www/html/reddsis_bak_20260901/app/Mail/ |
| Current File : /var/www/html/reddsis_bak_20260901/app/Mail/FeedbackSubmittedMail.php |
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class FeedbackSubmittedMail extends Mailable
{
use Queueable, SerializesModels;
public function __construct(
public array $data,
public string $type,
) {}
public function envelope(): Envelope
{
if ($this->type === 'admin') {
return new Envelope(
subject: 'New Feedback: ' . ($this->data['subject'] ?? 'No Subject'),
);
}
if ($this->type === 'reply') {
return new Envelope(
subject: 'Feedback Reply: ' . ($this->data['ticket_no'] ?? ''),
);
}
return new Envelope(
subject: 'Thank You! Your Feedback Has Been Received',
);
}
public function content(): Content
{
$view = match($this->type) {
'admin' => 'emails.feedback.admin-notification',
'reply' => 'emails.feedback.reply-notification',
default => 'emails.feedback.user-confirmation',
};
return new Content(
view: $view,
with: ['data' => $this->data],
);
}
public function attachments(): array
{
return [];
}
}