|
@@ -23,54 +23,20 @@ class UserController extends Controller
|
|
|
return $id->lastCoordinates;
|
|
|
}
|
|
|
|
|
|
- /*public function vse(){
|
|
|
- $userse = [];
|
|
|
- foreach (User::all() as $user){
|
|
|
- $userse[] = $user;
|
|
|
- }
|
|
|
- return $userse;
|
|
|
- }
|
|
|
-*/
|
|
|
+
|
|
|
public function action() {
|
|
|
$users=User::all();
|
|
|
|
|
|
return view('allpositions',compact('users'));
|
|
|
}
|
|
|
|
|
|
- public function date() {
|
|
|
- //[$id, date];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public function userdata(Request $request) {
|
|
|
-
|
|
|
- //$dates = DB::table('locations')->find($id);
|
|
|
- //return view('userdate',compact('dates'));
|
|
|
- $mysqli = mysqli_connect("geolook", "root", "2701198927", "geolook"); //Здесь свои данные пишем
|
|
|
- $dates = [];
|
|
|
- $id= "$request->id";
|
|
|
- $data= "$request->date%";
|
|
|
- $zapros = "SELECT * from locations where user_id = '$id' and created_at like '$data'";
|
|
|
-$res = mysqli_query($mysqli, $zapros);
|
|
|
-while($row = mysqli_fetch_object($res)) {
|
|
|
-
|
|
|
- // $dates[]= $request->date;
|
|
|
- $dates[] = $row->created_at;
|
|
|
- $dates[] = $row->lat;
|
|
|
- $dates[] = $row->lng;
|
|
|
- $dates[] = $row->id;
|
|
|
|
|
|
- //$dates[] = $request->id;
|
|
|
- // $dates[] = $_POST["{date}"];
|
|
|
- //$url='http://geolook/public/user/';
|
|
|
|
|
|
-//$dates[] = 'select * from locations where user_id='.$id.' and created_at like '.$date.'%';
|
|
|
-//$dates[] = mysqli_free_result($row);
|
|
|
-
|
|
|
-}
|
|
|
+ public function userdata(User $id, $date) {
|
|
|
+
|
|
|
|
|
|
-return view('userdate',compact('dates'));
|
|
|
+ return $id->locations()->whereDate('created_at', $date)->get();
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|