public function uploadPhoto(Request $request, $patient_id) { // $emp = HospitalEmployee::where('emp_id',$employeeId); if (!Patient::isPatient()) { return response()->json(["success" => false]); } $file = $request->file('file'); $mime = $file->getClientMimeType(); $name = $patient_id; $extension = $file->getClientOriginalExtension(); $patient = Patient::where('id', $patient_id)->first(); if (!$patient) { return response()->json(['success' => false, 'message' => 'patient_not_found']); } $patient->photo_extension = $extension; $patient->save(); Storage::disk('local')->put($name . '.' . $extension, File::get($file)); return response()->json(["success" => true, "patient_id" => $name]); }
public function getLastAppointment($patient_id) { if (!Patient::isPatient() && !HospitalEmployee::isDoctor() && !HospitalEmployee::isStaff()) { return response()->json(["success" => false, "error" => 'notlogin or notvalid']); } return response()->json(["success" => true, "data" => Appointment::getLastAppointment($patient_id)]); }