diff --git a/app/Console/Commands/DeviceLogDailyReportCommand.php b/app/Console/Commands/DeviceLogDailyReportCommand.php index 5c6c2f4..373d88d 100644 --- a/app/Console/Commands/DeviceLogDailyReportCommand.php +++ b/app/Console/Commands/DeviceLogDailyReportCommand.php @@ -76,7 +76,7 @@ class DeviceLogDailyReportCommand extends Command protected function createReportToLinkosMeteorologicalDevice(Device $device): void { $lastReportedAt = MeteorologicalDailyReport::where('device_id', $device->id)->latest('reported_at')->value('reported_at') - ?: MeteorologicalReport::where('device_id', $device->id)->latest('reported_at')->value('reported_at'); + ?: MeteorologicalReport::where('device_id', $device->id)->oldest('reported_at')->value('reported_at'); if ($lastReportedAt === null) { return; @@ -104,7 +104,7 @@ class DeviceLogDailyReportCommand extends Command protected function createReportToLinkosWaterQualityDevice(Device $device): void { $lastReportedAt = WaterQualityDailyReport::where('device_id', $device->id)->latest('reported_at')->value('reported_at') - ?: WaterQualityReport::where('device_id', $device->id)->latest('reported_at')->value('reported_at'); + ?: WaterQualityReport::where('device_id', $device->id)->oldest('reported_at')->value('reported_at'); if ($lastReportedAt === null) { return;