From a7ab27c9a5110143d2d3492be6f126f471ce3d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20St=C3=B6ckel?= Date: Sat, 23 Nov 2024 14:52:57 +0100 Subject: [PATCH] :bug: fix breaking changes with carbon 3 Laravel 11 supports both Carbon 2 and Carbon 3. Carbon is a date manipulation library utilized extensively by Laravel and packages throughout the ecosystem. If you upgrade to Carbon 3, be aware that diffIn* methods now return floating-point numbers and may return negative values to indicate time direction, which is a significant change from Carbon 2. Review Carbon's change log and documentation for detailed information on how to handle these and other changes. --- .../Controllers/Backend/Transport/TrainCheckinController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Backend/Transport/TrainCheckinController.php b/app/Http/Controllers/Backend/Transport/TrainCheckinController.php index ade26cab0..ae5b8474d 100644 --- a/app/Http/Controllers/Backend/Transport/TrainCheckinController.php +++ b/app/Http/Controllers/Backend/Transport/TrainCheckinController.php @@ -309,7 +309,7 @@ public static function refreshDistanceAndPoints(Status $status, bool $resetPolyl public static function calculateCheckinDuration(Checkin $checkin, bool $update = true): int { $departure = $checkin->manual_departure ?? $checkin->originStopover->departure ?? $checkin->departure; $arrival = $checkin->manual_arrival ?? $checkin->destinationStopover->arrival ?? $checkin->arrival; - $duration = $arrival->diffInMinutes($departure); + $duration = $departure->diffInMinutes($arrival); //don't use eloquent here, because it would trigger the observer (and this function) again if ($update) { DB::table('train_checkins')->where('id', $checkin->id)->update(['duration' => $duration]);