public function postRecommendation($id, RecommendationRequest $request)
 {
     if ($report = Reports::find($id)) {
         $doctor = auth()->user();
         $recommendation = new Recommendation();
         $recommendation->advice = $request->doc_advice;
         $recommendation->drugs = $request->doc_drug;
         $recommendation->doctor_id = $doctor->id;
         $recommendation->report_id = $id;
         $recommendation->save();
         return redirect()->back()->withFlashSuccess('Report Submitted Successfully');
     } else {
         abort(404);
     }
 }
 public function reportPage($id)
 {
     $report = Reports::find($id);
     if ($report) {
         $recommendation = Recommendation::where('report_id', $report->id)->join('users', 'users.id', '=', 'recommendations.doctor_id')->first();
         $conversations = Conversation::where('report_id', $report->id)->where('patient_id', auth()->user()->id)->get();
         $data = ['report' => $report, 'recommendation' => $recommendation, 'conversations' => $conversations];
         return view('frontend.user.report_page', $data);
     } else {
         abort(404);
     }
 }
Exemplo n.º 3
0
 /**
  * Check recommendation
  *
  * @param $id
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function checkRecommmendation($id, Request $request)
 {
     /**
      * @todo Use validator
      */
     if (is_numeric($id)) {
         $recommendation = Recommendation::find($id);
         /**
          * If exists, than remember
          */
         if (!empty($recommendation)) {
             Cache::forever('recommendation_id', $id);
         }
     }
     return redirect(route('frontend.homepage.index'));
 }