initial commit
This commit is contained in:
39
app/Listeners/SendPatientRegisteredEmail.php
Normal file
39
app/Listeners/SendPatientRegisteredEmail.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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.');
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user