/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($pid, $id) { $pat = Patient::with('agency')->where('pid', '=', $pid)->firstOrFail(); $dents = Auth::user()->dentists_list; $tnos = Dental::where('patient_id', $pat->pid)->whereIn('dentist_id', $dents)->where('trans_no', '=', $id); $dentists = Dental::with('dentist')->join('dentists', 'dental.dentist_id', '=', 'dentists.id')->where('dental.patient_id', $pat->pid)->whereIn('dental.dentist_id', $dents)->where('dentists.name', 'LIKE', '%' . $id . '%')->orWhere('dentists.prc', 'LIKE', '%' . $id . '%')->select('dental.*')->union($tnos)->orderBy('exam_dt', 'DESC')->simplePaginate($this->recPerPage); $data = array('pat' => $pat, 'results' => $dentists, 'pageTitle' => 'ODRMS - Patient Dental Records - ' . $pat->name); return view('patient.results.dental.index', $data); }
public static function whereTNO($tno) { return Dental::where('trans_no', '=', $tno)->firstOrFail(); }