/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $last_height = healthentry::where('user_id', Auth::user()->id)->where('type', healthentry::TYPE_HEIGHT)->orderBy('begin_time', 'desc')->first(); $last_weight = healthentry::where('user_id', Auth::user()->id)->where('type', healthentry::TYPE_WEIGTH)->orderBy('begin_time', 'desc')->first(); $last_bp = healthentry::where('user_id', Auth::user()->id)->where('type', healthentry::TYPE_BLOODPRESSURE)->orderBy('begin_time', 'desc')->first(); $last_hr = healthentry::where('user_id', Auth::user()->id)->where('type', healthentry::TYPE_HEARTRATE)->orderBy('begin_time', 'desc')->first(); $weights = healthentry::where('user_id', Auth::user()->id)->where('type', healthentry::TYPE_WEIGTH)->orderBy('begin_time')->get(); // Good&avg:h,w,bpl,bph,hr $goods = [185, 70, 90, 140, 70]; $avgs = [170, 64, 95, 150, 80]; $health_advices = healthadvice::where('player_id', Auth::user()->id)->get(); return view('player.health.user_health', ['health_advices' => $health_advices, 'last_height' => $last_height, 'last_weight' => $last_weight, 'last_bp' => $last_bp, 'last_hr' => $last_hr, 'weights' => $weights, 'goods' => $goods, 'avgs' => $avgs]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // $height = healthentry::where('user_id', $id)->where('type', healthentry::TYPE_HEIGHT)->orderBy('created_at', 'desc')->first(); $weight = healthentry::where('user_id', $id)->where('type', healthentry::TYPE_WEIGTH)->orderBy('created_at', 'desc')->first(); return view('player.user_modify', ['user' => User::find($id), 'player' => player::find($id), 'height' => $height, 'weight' => $weight]); }