get('view_type', 'si'); $patientId = $request->get('patient_id'); $patientInfo = null; if ($viewType == 'si') { $patient = SttMedicalHistory::where('id', $id)->first(); $archiveJournal = $patient->archiveHistory; $patientInfo = [ 'info' => $patient, 'journal' => $archiveJournal, ]; } return response()->json($patientInfo); } }