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'));
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(HealthFormRequest $request)
 {
     $id = Auth::user()->id;
     $healthInfo = new HealthReport(array('user_id' => Auth::user()->id, 'present_address' => $request->get('present_address'), 'permanent_address' => $request->get('permanent_address'), 'birth_date' => $request->get('birth_date'), 'age_beginning_course' => $request->get('age_beginning_course'), 'marital_status' => $request->get('marital_status'), 'present_disease' => $request->get('present_disease'), 'physical_disability' => $request->get('physical_disability')));
     $healthExam = new HealthExam(array('user_id' => Auth::user()->id, 'navel' => $request->get('navel'), 'blood_pressure' => $request->get('blood_pressure'), 'respiration' => $request->get('respiration'), 'anemia' => $request->get('anemia'), 'jaundice' => $request->get('jaundice'), 'weight' => $request->get('weight'), 'heart' => $request->get('heart'), 'lung' => $request->get('lung'), 'liver' => $request->get('liver'), 'spleen' => $request->get('spleen'), 'kidney' => $request->get('kidney'), 'hernia' => $request->get('hernia'), 'hydrocil' => $request->get('hydrocil'), 'left_eye' => $request->get('left_eye'), 'right_eye' => $request->get('right_eye'), 'comments_mofficer' => $request->get('comments_mofficer')));
     //dd($healthExam);
     if (HealthReport::where('user_id', '=', $id)->exists() and HealthExam::where('user_id', '=', $id)->exists()) {
         return redirect('/UserHealthInfos')->with('status', 'You have already given your health information');
     } else {
         $healthExam->save();
         $healthInfo->save();
         return redirect('/UserHealthInfos')->with('status', 'Your health information has been submitted!');
     }
     //return redirect('/UserHealthInfos')->with('status', 'Your health information has been created!');
     //print_r($healthInfo);
 }