locations; } return $locations; } public function show(User $id){ return $id->locations; } public function showLast(User $id){ $koordinata = $id->lastCoordinates; //return $id->lastCoordinates; return view('lastposition',compact('koordinata')); } public function action() { $users=User::all(); return view('allpositions',compact('users')); } public function userdata(User $id, $date) { //$dates = []; if($id){ $dates = $id->locations()->whereDate('created_at', $date)->get(); //return $id->locations()->whereDate('created_at', $date)->get(); return view('userdate',['user' => $id, 'dates' => $dates]); //return $dates[0]["lat"]." ".$dates[0]["lng"]; } return abort(404); } }