74 lines
1.9 KiB
PHP
74 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class RfpSubmittedMail extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public $rfpDetails;
|
|
|
|
/**
|
|
* Create a new message instance.
|
|
*
|
|
* @param mixed $rfpDetails Data to be used within the email view.
|
|
*/
|
|
public function __construct($rfpDetails)
|
|
{
|
|
$this->rfpDetails = $rfpDetails;
|
|
}
|
|
|
|
/**
|
|
* Get the message envelope.
|
|
*
|
|
* @return \Illuminate\Mail\Mailables\Envelope
|
|
*/
|
|
public function envelope(): Envelope
|
|
{
|
|
// Assuming 'category' is a human-readable string like "Urban Planning"
|
|
$title = isset($this->rfpDetails['formLabel']) ? $this->rfpDetails['formLabel'] : 'New Submission';
|
|
|
|
// Craft a more engaging and personalized email subject
|
|
$subject = "We got a new request | {$title} ";
|
|
|
|
return new Envelope(
|
|
subject: $subject,
|
|
);
|
|
}
|
|
|
|
|
|
/**
|
|
* Get the message content definition.
|
|
*
|
|
* @return \Illuminate\Mail\Mailables\Content
|
|
*/
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
// Make sure 'emails.rfp-submitted' points to an actual Blade view file at resources/views/emails/rfp-submitted.blade.php
|
|
view: 'emails.rfp-submitted',
|
|
with: ['rfpDetails' => $this->rfpDetails], // Pass the RFP details to the view
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Define attachments for the message, if needed.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function attachments(): array
|
|
{
|
|
// Example: Attach a file from storage
|
|
// return [new Attachment(storage_path('path/to/your/file.pdf'), 'Filename.pdf')];
|
|
|
|
return []; // Return an empty array if no attachments are needed
|
|
}
|
|
}
|