我已使用xampp本地服务器使用save()
函数Laravel成功插入数据。但是当我尝试从实时服务器bluehost
插入数据时,它会出错
GET http://sencare.com.bd/sencare.com.bd/confirm_appointment?patient_name=sabbir&patient_number=01654&patient_email=rahmanarafat13%40gmail.com&patient_age=2&patient_gender=1&service_id=1&schedule_time_id=1&date=+2018-03-19 500 (Internal Server Error)
send @ jquery-2.1.4.min.js:4
ajax @ jquery-2.1.4.min.js:4
n.(anonymous function) @ jquery-2.1.4.min.js:4
(anonymous) @ (index):2069
dispatch @ jquery-2.1.4.min.js:3
r.handle @ jquery-2.1.4.min.js:3
控制器代码
$data = new Appointment;
$data->patient_name = $request->patient_name;
$data->patient_number = $request->patient_number;
$data->save();
$lastInsertedId = $data->id;
if($lastInsertedId > 0)
{
$service_name = Service::find($request->service_id);
$schedule_time = ScheduleTime::find($request->schedule_time_id);
$schedule_date = Appointment::find($lastInsertedId);
$emailDataArray = array(
'patient_name' => $request->patient_name,
'patient_number' => $request->patient_number,
'patient_email' => $request->patient_email,
'patient_age' => $request->patient_age,
'schedule_date' => $schedule_date->schedule_date,
'schedule_time' => $schedule_time->schedule_time,
'service_name' => $service_name->name
);
$this->sendMail($emailDataArray);
// return $schedule_date->schedule_date;
// return $emailDataArray['patient_email'];
return $lastInsertedId;
}
return 0;
此处Appointment
是包含表appointments
的模型,在该表中我想插入数据。
问题在哪里有人帮忙吗?