1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace App\Http\Controllers;
- use App\User;
- use Illuminate\Http\Request;
- class UserController extends Controller
- {
- public function index(){
- $locations = [];
- foreach (User::all() as $user){
- $locations[] = $user->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 = [];
- $dates = $id->locations()->whereDate('created_at', $date)->get();
- //return $id->locations()->whereDate('created_at', $date)->get();
- return view('userdate',compact('dates'));
- //return $dates[0]["lat"]." ".$dates[0]["lng"];
- }
- }
|