first commit
This commit is contained in:
46
app/Mail/CustomMailer.php
Normal file
46
app/Mail/CustomMailer.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user