123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?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){
- $userse = $id->locations;
- //return view('user',compact('userse'));
- return view('user',['uss' => $id, 'userse' =>$userse]);
- //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);
- }
- }
|