40 lines
933 B
PHP
40 lines
933 B
PHP
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use App\Events\PatientRegistered;
|
|
use App\Models\Setting;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Support\Facades\Mail;
|
|
|
|
class SendPatientRegisteredEmail implements ShouldQueue
|
|
{
|
|
/**
|
|
* Create the event listener.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the event.
|
|
*/
|
|
public function handle(PatientRegistered $event)
|
|
{
|
|
$patient = $event->patient;
|
|
$validatedData = $event->validatedData;
|
|
|
|
$setting = Setting::find(1);
|
|
|
|
Mail::send('emails.registration', [
|
|
'patient' => $patient,
|
|
'setting' => $setting
|
|
], function ($message) use ($validatedData) {
|
|
$message->to($validatedData['email'], $validatedData['first_name'])
|
|
->subject('Account Registered Successfully.');
|
|
});
|
|
}
|
|
}
|