/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $name = Patient::where(DB::raw('CONCAT_WS(" ", last, first, middle)'), 'LIKE', '%' . $id . '%')->orWhere(DB::raw('CONCAT_WS(" ", first, middle, last)'), 'LIKE', '%' . $id . '%')->orWhere(DB::raw('CONCAT_WS(" ", first, last)'), 'LIKE', '%' . $id . '%'); $pos = Patient::where('position', 'LIKE', '%' . $id . '%'); $ags = Patient::select('patients.*')->join('agencies', 'agencies.id', '=', 'patients.agency_id')->where('agencies.code', 'LIKE', '%' . $id . '%')->orWhere('agencies.name', 'LIKE', '%' . $id . '%'); $patients = Patient::with('agency')->where('pid', '=', $id)->union($name)->union($pos)->union($ags)->simplePaginate($this->recPerPage); $pageTitle = 'ODRMS - Patient Dental Records'; return view('patient.index', ['pats' => $patients, 'pageTitle' => $pageTitle]); }
public function fullname($id) { $patient = \App\Patient::select(\DB::raw("CONCAT(pfname,' ', pmname,' ',plname) AS full_name"))->where('id', '=', $id)->lists('full_name')->first(); return $patient; }