61 lines
1.5 KiB
PHP
61 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Models\Patient;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class RegistrationReminder extends Notification
|
|
{
|
|
use Queueable;
|
|
protected $patientId;
|
|
|
|
/**
|
|
* Create a new notification instance.
|
|
*/
|
|
public function __construct($patientId)
|
|
{
|
|
$this->patientId = $patientId;
|
|
}
|
|
|
|
/**
|
|
* Get the notification's delivery channels.
|
|
*
|
|
* @return array<int, string>
|
|
*/
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
/**
|
|
* Get the mail representation of the notification.
|
|
*/
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
$patient = Patient::findOrFail($this->patientId);
|
|
echo "email sent";
|
|
return (new MailMessage)
|
|
->subject('Complete Your Registration')
|
|
->greeting('Dear ' . $patient->name)
|
|
->line('This is a friendly reminder to complete your registration process.')
|
|
->action('Complete Registration', url('/registration/' . $this->patientId))
|
|
->line('Thank you for using our application!');
|
|
}
|
|
|
|
/**
|
|
* Get the array representation of the notification.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(object $notifiable): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
}
|