예제 #1
0
 /**
  * Shows the page of a specific Treatment to the user.
  *
  * @return show view
  */
 public function show($id)
 {
     $treatment = DoctorTreatment::findOrFail($id);
     $user = Session::get('user');
     $doctor = Doctor::findOrFail($treatment->doctor_id);
     $image1 = 1;
     $image2 = 1;
     $image3 = 1;
     $image4 = 1;
     if ($treatment->image1 == 'NONE') {
         $image1 = 0;
     }
     if ($treatment->image2 == 'NONE') {
         $image2 = 0;
     }
     if ($treatment->image3 == 'NONE') {
         $image3 = 0;
     }
     if ($treatment->image4 == 'NONE') {
         $image4 = 0;
     }
     return View::make('treatment.show')->with('treatment', $treatment)->with('user', $user)->with('image1', $image1)->with('image2', $image2)->with('image3', $image3)->with('image4', $image4)->with('doctor', $doctor);
 }
 public function home()
 {
     $patients = Doctor::findOrFail(Auth::user()->doctor_id)->patient()->get();
     return view('pages.doctor', compact('patients'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $doctor = Doctor::findOrFail($id);
     return view('doctors.edit', ['doctor' => $doctor]);
 }
예제 #4
0
 /**
  * Shows the page of a pending Doctor to the admin.
  *
  * @return showpending view
  */
 public function updateDoctorReview($id)
 {
     $user = Session::get('user');
     $doctor = Doctor::findOrFail($id);
     $addedRating = Request::get('rating');
     $newRating;
     if ($doctor->rated == 0) {
         $newRating = $addedRating;
         Doctor::where('id', $id)->update(['rated' => 1]);
     } else {
         $newRating = ($doctor->rating + $addedRating) / 2.0;
     }
     Doctor::where('id', $id)->update(['rating' => $newRating]);
     $userReview = Request::get('review');
     $newReview = new reviews();
     $newReview->user_id = $user->id;
     $newReview->user_name = $user->name;
     $newReview->doctor_id = $doctor->id;
     $newReview->doctor_name = $doctor->first_name . ' ' . $doctor->last_name;
     $newReview->review = $userReview;
     $newReview->save();
     return redirect()->back();
 }