input('_type') !== 'location') { return response()->json([], 200); } $validated = $request->validate([ 'lat' => 'required|numeric', 'lon' => 'required|numeric', 'tst' => 'required|integer', 'alt' => 'nullable|numeric', 'batt' => 'nullable|integer', 'vel' => 'nullable|integer', 'acc' => 'nullable|integer', ]); $activeJob = app(JobLifecycleService::class)->findActiveJob($request->user()); if ($activeJob === null) { return response()->json([], 200); } GpsPoint::create([ 'user_id' => $request->user()->id, 'job_id' => $activeJob->id, 'lat' => $validated['lat'], 'lon' => $validated['lon'], 'timestamp' => $validated['tst'], 'altitude' => $validated['alt'] ?? null, 'battery' => $validated['batt'] ?? null, 'velocity' => $validated['vel'] ?? null, 'accuracy' => $validated['acc'] ?? null, ]); return response()->json([], 200); } }