diff --git a/app/Models/Traffic.php b/app/Models/Traffic.php index f2cc7e6..e721d83 100644 --- a/app/Models/Traffic.php +++ b/app/Models/Traffic.php @@ -47,7 +47,7 @@ class Traffic extends Authenticatable ]; public static function getLastDays(int $days = 7) { - $sql = "SELECT year, month, day, typ, SUM(traffic) AS `traffic` FROM traffic WHERE tenant = ".session("current_tenant_id")." GROUP BY year, month, day, typ ORDER BY year, month, day DESC LIMIT ".$days.";"; + $sql = "SELECT year, month, day, typ, SUM(traffic) AS `traffic` FROM traffic WHERE tenant = ".session("current_tenant_id")." GROUP BY year, month, day, typ ORDER BY year DESC, month DESC, day DESC LIMIT ".$days.";"; $res = DB::select($sql); $now = new \DateTime( $days." days ago", new \DateTimeZone('UTC'));