master_template/app/Mail/CustomMailer.php
2024-06-10 18:06:58 +05:45

47 lines
1.2 KiB
PHP

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class CustomMailer extends Mailable
{
use Queueable, SerializesModels;
public $formData;
public function __construct($formData)
{
$this->formData = $formData;
}
public function enquiryform()
{
$viewPath = 'accessskills.emails.enquiry-submitted';
if (view()->exists($viewPath)) {
return $this->subject('Received a new online enquiry from our website.')
->markdown($viewPath, $this->formData);
} else {
return $this->subject('Received a new online enquiry from our website.')
->view('emails.enquiry-submitted', $this->formData);
}
}
public function enquiryresponse()
{
$viewPath = 'accessskills.emails.enquiry-response';
if (view()->exists($viewPath)) {
return $this->subject('Thank you from ' . env('APP_NAME'))
->markdown($viewPath, $this->formData);
} else {
return $this->subject('Thank you from ' . env('APP_NAME'))
->view('emails.enquiry-response', $this->formData);
}
}
}