/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update($id, HealthFormRequest $request) { $healthInfo = HealthReport::whereUserId($id)->firstOrFail(); $healthInfo->present_address = $request->get('present_address'); $healthInfo->permanent_address = $request->get('permanent_address'); $healthInfo->birth_date = $request->get('birth_date'); $healthInfo->age_beginning_course = $request->get('age_beginning_course'); $healthInfo->marital_status = $request->get('marital_status'); $healthInfo->present_disease = $request->get('present_disease'); $healthInfo->physical_disability = $request->get('physical_disability'); $healthInfo->save(); $healthExam = HealthExam::whereUserId($id)->firstOrFail(); $healthExam->navel = $request->get('navel'); $healthExam->anemia = $request->get('anemia'); $healthExam->blood_pressure = $request->get('blood_pressure'); $healthExam->jaundice = $request->get('jaundice'); $healthExam->respiration = $request->get('respiration'); $healthExam->weight = $request->get('weight'); $healthExam->heart = $request->get('heart'); $healthExam->kidney = $request->get('kidney'); $healthExam->lung = $request->get('lung'); $healthExam->hernia = $request->get('hernia'); $healthExam->hydrocil = $request->get('hydrocil'); $healthExam->spleen = $request->get('spleen'); $healthExam->left_eye = $request->get('left_eye'); $healthExam->right_eye = $request->get('right_eye'); $healthExam->comments_mofficer = $request->get('comments_mofficer'); $healthExam->save(); return redirect(action('HealthController@edit', $healthInfo->user_id))->with('status', 'The User_id ' . $healthInfo->user_id . ' has been updated!'); }
public function healthView($id) { $healthInfo = HealthReport::whereUserId($id)->firstOrFail(); $healthExam = HealthExam::whereUserId($id)->firstOrFail(); return view('view_trainee_report.healthView', compact('healthInfo', 'healthExam')); if (HealthReport::where('user_id', '=', $id)->exists() and HealthExam::where('user_id', '=', $id)->exists()) { return view('view_trainee_report.healthView', compact('healthInfo', 'healthExam')); } }
public function healthView($id) { $healthInfo = HealthReport::whereUserId($id)->firstOrFail(); $healthExam = HealthExam::whereUserId($id)->firstOrFail(); return view('view_trainee_report.healthView', compact('healthInfo', 'healthExam')); }