From a4d71188e6d14391a5108ce20b57a8b2e84ea14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Scho=CC=88ps?= Date: Wed, 17 Feb 2021 22:45:14 +0100 Subject: [PATCH] Track geo spatial data --- .../migrations/2021_02_13_000001_laravel_track_migrations.php | 2 ++ src/Models/Visitor.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/database/migrations/2021_02_13_000001_laravel_track_migrations.php b/database/migrations/2021_02_13_000001_laravel_track_migrations.php index af45038..22c6c40 100644 --- a/database/migrations/2021_02_13_000001_laravel_track_migrations.php +++ b/database/migrations/2021_02_13_000001_laravel_track_migrations.php @@ -31,6 +31,8 @@ public function up() $table->string('browser_version')->index()->nullable(); $table->string('country')->index()->nullable(); $table->string('city')->index()->nullable(); + $table->decimal('lat', 10, 7)->index()->nullable(); + $table->decimal('lng', 10, 7)->index()->nullable(); $table->timestamps(); }); diff --git a/src/Models/Visitor.php b/src/Models/Visitor.php index bb699ea..9c6cf1a 100644 --- a/src/Models/Visitor.php +++ b/src/Models/Visitor.php @@ -74,6 +74,8 @@ public function fillInfo() 'browser_version' => $agent->version($browser), 'country' => $geo->country, 'city' => $geo->city, + 'lat' => $geo->lat, + 'lng' => $geo->lon, ]); });