diff --git a/app/Services/VehicleService.php b/app/Services/VehicleService.php index 0a24520..ad71698 100644 --- a/app/Services/VehicleService.php +++ b/app/Services/VehicleService.php @@ -20,8 +20,14 @@ public function procesarDeteccion(string $epc, string $fastId, string $arcoIp, ? $key = "vehiculo:robado:{$epc}"; // Buscar o crear arco por IP - $arco = Arco::buscarPorIp($arcoIp); - $arcoId = $arco?->id; + $arco = Arco::firstOrCreate( + ['ip_address' => $arcoIp], + [ + 'nombre' => 'Arco ' . $arcoIp, + 'activo' => true + ] + ); + $arcoId = $arco->id; // Verificar si está en Redis $enRedis = Redis::get($key);