Browse Source

Merge branch 'Nikitin' of gitgod/geolook into master

Serge 5 years ago
parent
commit
4f50e6ea32

+ 18 - 1
app/Http/Controllers/UserController.php

@@ -16,10 +16,27 @@ class UserController extends Controller
     }
 
     public function show(User $id){
-        return $id->locations;
+       return $id->locations;
     }
 
     public function showLast(User $id){
         return $id->lastCoordinates;
     }
+
+
+ public function action() {
+            $users=User::all();
+                 
+        return view('allpositions',compact('users'));
+    }
+    
+    
+
+    public function userdata(User $id, $date) {
+      
+
+    return $id->locations()->whereDate('created_at', $date)->get();
+  
+   
+    }
 }

+ 24 - 0
resources/views/allpositions.blade.php

@@ -0,0 +1,24 @@
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <title>Document</title>
+</head>
+<body>
+
+    <ul>
+      @foreach ($users as $user)
+
+
+        <li>
+        	<a href="{{route('user.position', $user->id)}}">{{ $user->name }}</a>
+        </li>
+
+
+    @endforeach
+    </ul>
+</body>
+
+   
+</html>

+ 25 - 0
resources/views/userdate.blade.php

@@ -0,0 +1,25 @@
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <title>Document</title>
+</head>
+<body>
+
+    <ul>
+      @foreach ($dates as $data)
+
+
+        <li>
+		
+        	{{ $data }}
+        </li>
+
+
+    @endforeach
+    </ul>
+</body>
+
+   
+</html>

+ 3 - 2
routes/web.php

@@ -19,10 +19,11 @@ Auth::routes();
 
 Route::get('/home', 'HomeController@index')->name('home');
 
-Route::get('/user', 'UserController@index')->name('all.positions');
+Route::get('/user','UserController@action');
 Route::get('/user/{id}', 'UserController@show')->where('id', '[0-9]+')->name('user.position');
+Route::get('/user/{id}/{date}', 'UserController@userdata')->where(['id'=>'[0-9]+','date'=>'[0-9]{4}-[0-9]{2}-[0-9]{2}'])->name('user.date');
 Route::get('/user/{id}/last', 'UserController@showLast')->where('id', '[0-9]+')->name('last.position');
-
 Route::post('/tbot/'.Telegram::getAccessToken(), function(){
     Telegram::commandsHandler(true);
 });
+