I have an online appointment form from where user can take appointment. An email will be generated after taking appointment. But getting below error while sending email.
Trying to access array offset on value of type null
store function inside appointment controller
$emailDataArray = array(
'appointment_id' => $lastInsertedId,
'patient_name' => $request->appointment_name,
'patient_number' => $request->appointment_contact_no,
'patient_age' => $request->appointment_age,
'patient_gender' => $request->appointment_gender,
'branch_name' => $branch_name->name,
'doctor_name' => $doctor_name->name,
'schedule_date' => $request->schedule_date,
'schedule_time' => $schedule_time->schedule_time,
'purpose' => $purpose->about_us,
);
$email = $this->sendMail($emailDataArray);
sendMail function inside appointment controller
Mail::send('frontend.mail.mail', $emailDataArray, function($message) use ($emailDataArray)
{
$message->to('[email protected]')->subject('APPOINTMENT');
$message->from('[email protected]');
});
mail.blade.php
<p>PATIENT NAME 	: {{ $patient_name }}</p>
<p>PATIENT NUMBER 	: {{ $patient_number }}</p>
<p>PATIENT AGE 	: {{ $patient_age }}</p>
<p>PATIENT GENDER 	: {{ $patient_gende] }}</p>
<p>BRANCH NAME 	: {{ $branch_name }}</p>
<p>DOCTOR NAME 	: {{ $doctor_name}}</p>
<p>DATE 	: {{ $schedule_date }}</p>
<p>TIME 	: {{ $schedule_time }}</p>
<p>PURPOSE 	: {{ $purpose }}</p>
How to solve this? Anybody Help please?