public function showMedical($id) { $patient = Patient::findOrFail($id); $questions = MedicalQuestion::where('active', 1)->orderBy('order', 'desc')->get(); $stored_answers = MedicalQuestionAnswer::where('patient_id', $patient->id)->get(); $answers = array(); foreach ($stored_answers as $a) { $answers[$a->question_id] = $a->answer; } view()->share('show_patient_nav', true); $vars = array('current_nav' => 2, "patient" => $patient, "questions" => $questions, "answers" => $answers); return view('backend.page.patient-medical')->with($vars); }