/** * Show the application dashboard to the user. * * @return Response */ public function index() { $doctor = Session::get('doctor'); $count = tickets::where('userid', Session::get('userid'))->count(); $countAppointment = doctorSchedule::where('uid', '=', Session::get('userid'))->count(); if (is_null($doctor)) { return view('user.userprofile')->with('user', Session::get('user'))->with('ticketCount', $count)->with('appointmentCount', $countAppointment); } else { return view('user.userprofile')->with('user', Session::get('user'))->with('doctor', $doctor)->with('ticketCount', $count)->with('appointmentCount', $countAppointment); } }
/** * * Return the Closed tickets as Json Response * * @param get the pagination number * @return Json Response * */ private function loadTableClosedTickets($skiper) { $tickets = tickets::where('userid', Session::get('userid'))->where('opened', 0)->skip($this->resultCount * $skiper)->take($this->resultCount)->get(); $count = tickets::where('userid', Session::get('userid'))->where('opened', 0)->count(); $lastMessages = array(); for ($x = 0; $x < sizeof($tickets); $x++) { $ticketsMessages = tickets_messages::where('ticket_id', $tickets[$x]->id)->orderBy('id', 'desc')->first(); $lastMessages[] = $ticketsMessages; } return response()->json(['tickets' => $tickets, 'code' => 'success', 'task' => 'loadtableclosedtickets', 'total' => $count, 'msgs' => $lastMessages, 'skips' => $this->resultCount]); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $wanted = user::where('id', $id)->first(); if (is_null($wanted)) { return "Not Found"; } else { $doctor = Doctor::where('email', '=', $wanted->email)->first(); $count = tickets::where('userid', $wanted->id)->count(); $countAppointment = doctorSchedule::where('uid', '=', $wanted->id)->count(); if (is_null($doctor)) { return view('user.profileview')->with('user', Session::get('user'))->with('viewing', $wanted)->with('ticketCount', $count)->with('appointmentCount', $countAppointment); } else { return view('user.profileview')->with('user', Session::get('user'))->with('viewing', $wanted)->with('doctor', $doctor)->with('ticketCount', $count)->with('appointmentCount', $countAppointment); } } }