UserController.php 468 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\User;
  4. use Illuminate\Http\Request;
  5. class UserController extends Controller
  6. {
  7. public function index(){
  8. $locations = [];
  9. foreach (User::all() as $user){
  10. $locations[] = $user->locations;
  11. }
  12. return $locations;
  13. }
  14. public function show(User $id){
  15. return $id->locations;
  16. }
  17. public function showLast(User $id){
  18. return $id->lastCoordinates;
  19. }
  20. }