purityselect/app/Notifications/AppointmentReminder.php
2024-10-25 01:05:27 +05:00

62 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 AppointmentReminder 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 [
//
];
}
}